ruby-changes:48826
From: marcandre <ko1@a...>
Date: Thu, 30 Nov 2017 04:46:52 +0900 (JST)
Subject: [ruby-changes:48826] marcandRe: r60943 (trunk): Cherrypick 9f8d3d0 from ruby/spec
marcandre 2017-11-30 04:46:46 +0900 (Thu, 30 Nov 2017) New Revision: 60943 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60943 Log: Cherrypick 9f8d3d0 from ruby/spec Modified files: trunk/spec/ruby/core/module/alias_method_spec.rb trunk/spec/ruby/core/module/attr_accessor_spec.rb trunk/spec/ruby/core/module/attr_reader_spec.rb trunk/spec/ruby/core/module/attr_spec.rb trunk/spec/ruby/core/module/attr_writer_spec.rb trunk/spec/ruby/core/module/define_method_spec.rb trunk/spec/ruby/core/module/remove_method_spec.rb trunk/spec/ruby/core/module/undef_method_spec.rb Index: spec/ruby/core/module/attr_writer_spec.rb =================================================================== --- spec/ruby/core/module/attr_writer_spec.rb (revision 60942) +++ spec/ruby/core/module/attr_writer_spec.rb (revision 60943) @@ -58,7 +58,14 @@ describe "Module#attr_writer" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_writer_spec.rb#L58 lambda { c.new.foo=1 }.should raise_error(NoMethodError) end - it "is a private method" do - lambda { Class.new.attr_writer(:foo) }.should raise_error(NoMethodError) + ruby_version_is ''...'2.5' do + 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 Index: spec/ruby/core/module/attr_spec.rb =================================================================== --- spec/ruby/core/module/attr_spec.rb (revision 60942) +++ spec/ruby/core/module/attr_spec.rb (revision 60943) @@ -143,7 +143,14 @@ describe "Module#attr" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_spec.rb#L143 }.should complain(/boolean argument is obsoleted/) end - it "is a private method" do - lambda { Class.new.attr(:foo) }.should raise_error(NoMethodError) + ruby_version_is ''...'2.5' do + 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 Index: spec/ruby/core/module/define_method_spec.rb =================================================================== --- spec/ruby/core/module/define_method_spec.rb (revision 60942) +++ spec/ruby/core/module/define_method_spec.rb (revision 60943) @@ -357,8 +357,15 @@ describe "Module#define_method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/define_method_spec.rb#L357 klass.new.string_test.should == "string_test result" end - it "is private" do - Module.should have_private_instance_method(:define_method) + ruby_version_is ''...'2.5' do + 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 it "returns its symbol" do Index: spec/ruby/core/module/attr_accessor_spec.rb =================================================================== --- spec/ruby/core/module/attr_accessor_spec.rb (revision 60942) +++ spec/ruby/core/module/attr_accessor_spec.rb (revision 60943) @@ -63,8 +63,15 @@ describe "Module#attr_accessor" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_accessor_spec.rb#L63 lambda { c.new.foo=1 }.should raise_error(NoMethodError) end - it "is a private method" do - lambda { Class.new.attr_accessor(:foo) }.should raise_error(NoMethodError) + ruby_version_is ''...'2.5' do + 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 describe "on immediates" do Index: spec/ruby/core/module/alias_method_spec.rb =================================================================== --- spec/ruby/core/module/alias_method_spec.rb (revision 60942) +++ spec/ruby/core/module/alias_method_spec.rb (revision 60943) @@ -69,8 +69,15 @@ describe "Module#alias_method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/alias_method_spec.rb#L69 lambda { @class.make_alias mock('x'), :public_one }.should raise_error(TypeError) end - it "is a private method" do - lambda { @class.alias_method :ichi, :public_one }.should raise_error(NoMethodError) + ruby_version_is ''...'2.5' do + 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 it "returns self" do Index: spec/ruby/core/module/attr_reader_spec.rb =================================================================== --- spec/ruby/core/module/attr_reader_spec.rb (revision 60942) +++ spec/ruby/core/module/attr_reader_spec.rb (revision 60943) @@ -58,7 +58,14 @@ describe "Module#attr_reader" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/attr_reader_spec.rb#L58 lambda { c.new.foo }.should raise_error(NoMethodError) end - it "is a private method" do - lambda { Class.new.attr_reader(:foo) }.should raise_error(NoMethodError) + ruby_version_is ''...'2.5' do + 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 Index: spec/ruby/core/module/remove_method_spec.rb =================================================================== --- spec/ruby/core/module/remove_method_spec.rb (revision 60942) +++ spec/ruby/core/module/remove_method_spec.rb (revision 60943) @@ -20,8 +20,15 @@ describe "Module#remove_method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/remove_method_spec.rb#L20 @module = Module.new { def method_to_remove; end } end - it "is a private method" do - Module.should have_private_instance_method(:remove_method, false) + ruby_version_is ''...'2.5' do + 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 it "removes the method from a class" do Index: spec/ruby/core/module/undef_method_spec.rb =================================================================== --- spec/ruby/core/module/undef_method_spec.rb (revision 60942) +++ spec/ruby/core/module/undef_method_spec.rb (revision 60943) @@ -18,8 +18,15 @@ describe "Module#undef_method" do https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/module/undef_method_spec.rb#L18 @module = Module.new { def method_to_undef; end } end - it "is a private method" do - Module.should have_private_instance_method(:undef_method, false) + ruby_version_is ''...'2.5' do + 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 it "requires multiple arguments" do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/