mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Cherrypick 9f8d3d0 from ruby/spec
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0c03a89ecd
commit
87bcbf9ef5
8 changed files with 72 additions and 16 deletions
|
@ -69,8 +69,15 @@ describe "Module#alias_method" do
|
||||||
lambda { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError)
|
lambda { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
lambda { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError)
|
it "is a private method" do
|
||||||
|
lambda { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:alias_method, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns self" do
|
it "returns self" do
|
||||||
|
|
|
@ -63,8 +63,15 @@ describe "Module#attr_accessor" do
|
||||||
lambda { c.new.foo=1 }.should raise_error(NoMethodError)
|
lambda { c.new.foo=1 }.should raise_error(NoMethodError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
lambda { Class.new.attr_accessor(:foo) }.should raise_error(NoMethodError)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:attr_accessor, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:attr_accessor, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "on immediates" do
|
describe "on immediates" do
|
||||||
|
|
|
@ -58,7 +58,14 @@ describe "Module#attr_reader" do
|
||||||
lambda { c.new.foo }.should raise_error(NoMethodError)
|
lambda { c.new.foo }.should raise_error(NoMethodError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
lambda { Class.new.attr_reader(:foo) }.should raise_error(NoMethodError)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:attr_reader, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:attr_reader, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -143,7 +143,14 @@ describe "Module#attr" do
|
||||||
}.should complain(/boolean argument is obsoleted/)
|
}.should complain(/boolean argument is obsoleted/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
lambda { Class.new.attr(:foo) }.should raise_error(NoMethodError)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:attr, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:attr, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -58,7 +58,14 @@ describe "Module#attr_writer" do
|
||||||
lambda { c.new.foo=1 }.should raise_error(NoMethodError)
|
lambda { c.new.foo=1 }.should raise_error(NoMethodError)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
lambda { Class.new.attr_writer(:foo) }.should raise_error(NoMethodError)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:attr_writer, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:attr_writer, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -357,8 +357,15 @@ describe "Module#define_method" do
|
||||||
klass.new.string_test.should == "string_test result"
|
klass.new.string_test.should == "string_test result"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is private" do
|
ruby_version_is ''...'2.5' do
|
||||||
Module.should have_private_instance_method(:define_method)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:define_method)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:define_method)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns its symbol" do
|
it "returns its symbol" do
|
||||||
|
|
|
@ -20,8 +20,15 @@ describe "Module#remove_method" do
|
||||||
@module = Module.new { def method_to_remove; end }
|
@module = Module.new { def method_to_remove; end }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
Module.should have_private_instance_method(:remove_method, false)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:remove_method, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:remove_method, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "removes the method from a class" do
|
it "removes the method from a class" do
|
||||||
|
|
|
@ -18,8 +18,15 @@ describe "Module#undef_method" do
|
||||||
@module = Module.new { def method_to_undef; end }
|
@module = Module.new { def method_to_undef; end }
|
||||||
end
|
end
|
||||||
|
|
||||||
it "is a private method" do
|
ruby_version_is ''...'2.5' do
|
||||||
Module.should have_private_instance_method(:undef_method, false)
|
it "is a private method" do
|
||||||
|
Module.should have_private_instance_method(:undef_method, false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ruby_version_is '2.5' do
|
||||||
|
it "is a public method" do
|
||||||
|
Module.should have_public_instance_method(:undef_method, false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "requires multiple arguments" do
|
it "requires multiple arguments" do
|
||||||
|
|
Loading…
Reference in a new issue