зеркало из https://github.com/github/ruby.git
spec/ruby/core/module/attr_*: Add version guards
This commit is contained in:
Родитель
5944c4b3cf
Коммит
346bf0f5a5
|
@ -67,9 +67,19 @@ describe "Module#attr_accessor" do
|
|||
Module.should have_public_instance_method(:attr_accessor, false)
|
||||
end
|
||||
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_accessor :foo, 'bar').should == [:foo, :foo=, :bar, :bar=]
|
||||
ruby_version_is ""..."3.0" do
|
||||
it "returns nil" do
|
||||
Class.new do
|
||||
(attr_accessor :foo, 'bar').should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "3.0" do
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_accessor :foo, 'bar').should == [:foo, :foo=, :bar, :bar=]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -62,9 +62,19 @@ describe "Module#attr_reader" do
|
|||
Module.should have_public_instance_method(:attr_reader, false)
|
||||
end
|
||||
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_reader :foo, 'bar').should == [:foo, :bar]
|
||||
ruby_version_is ""..."3.0" do
|
||||
it "returns nil" do
|
||||
Class.new do
|
||||
(attr_reader :foo, 'bar').should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "3.0" do
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_reader :foo, 'bar').should == [:foo, :bar]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -146,11 +146,23 @@ describe "Module#attr" do
|
|||
Module.should have_public_instance_method(:attr, false)
|
||||
end
|
||||
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr :foo, 'bar').should == [:foo, :bar]
|
||||
(attr :baz, false).should == [:baz]
|
||||
(attr :qux, true).should == [:qux, :qux=]
|
||||
ruby_version_is ""..."3.0" do
|
||||
it "returns nil" do
|
||||
Class.new do
|
||||
(attr :foo, 'bar').should == nil
|
||||
(attr :baz, false).should == nil
|
||||
(attr :qux, true).should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "3.0" do
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr :foo, 'bar').should == [:foo, :bar]
|
||||
(attr :baz, false).should == [:baz]
|
||||
(attr :qux, true).should == [:qux, :qux=]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -62,9 +62,19 @@ describe "Module#attr_writer" do
|
|||
Module.should have_public_instance_method(:attr_writer, false)
|
||||
end
|
||||
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_writer :foo, 'bar').should == [:foo=, :bar=]
|
||||
ruby_version_is ""..."3.0" do
|
||||
it "returns nil" do
|
||||
Class.new do
|
||||
(attr_writer :foo, 'bar').should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "3.0" do
|
||||
it "returns an array of defined methods names as symbols" do
|
||||
Class.new do
|
||||
(attr_writer :foo, 'bar').should == [:foo=, :bar=]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче