summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-29 19:46:46 +0000
committermarcandre <marcandre@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-29 19:46:46 +0000
commit87bcbf9ef53de9db889ce51de057f26f55afe7d3 (patch)
tree26218a29274bfb3ea03d41cde10071107c8da5df /spec
parent0c03a89ecd71ebdc1ea983264424ba5c46f8c4e1 (diff)
Cherrypick 9f8d3d0 from ruby/spec
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/module/alias_method_spec.rb11
-rw-r--r--spec/ruby/core/module/attr_accessor_spec.rb11
-rw-r--r--spec/ruby/core/module/attr_reader_spec.rb11
-rw-r--r--spec/ruby/core/module/attr_spec.rb11
-rw-r--r--spec/ruby/core/module/attr_writer_spec.rb11
-rw-r--r--spec/ruby/core/module/define_method_spec.rb11
-rw-r--r--spec/ruby/core/module/remove_method_spec.rb11
-rw-r--r--spec/ruby/core/module/undef_method_spec.rb11
8 files changed, 72 insertions, 16 deletions
diff --git a/spec/ruby/core/module/alias_method_spec.rb b/spec/ruby/core/module/alias_method_spec.rb
index 7ad71f41f9..d3c0529418 100644
--- a/spec/ruby/core/module/alias_method_spec.rb
+++ b/spec/ruby/core/module/alias_method_spec.rb
@@ -69,8 +69,15 @@ describe "Module#alias_method" do
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
diff --git a/spec/ruby/core/module/attr_accessor_spec.rb b/spec/ruby/core/module/attr_accessor_spec.rb
index 4bd198dedc..c6f7aad6af 100644
--- a/spec/ruby/core/module/attr_accessor_spec.rb
+++ b/spec/ruby/core/module/attr_accessor_spec.rb
@@ -63,8 +63,15 @@ describe "Module#attr_accessor" do
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
diff --git a/spec/ruby/core/module/attr_reader_spec.rb b/spec/ruby/core/module/attr_reader_spec.rb
index f2b968d3fc..65cafdba9f 100644
--- a/spec/ruby/core/module/attr_reader_spec.rb
+++ b/spec/ruby/core/module/attr_reader_spec.rb
@@ -58,7 +58,14 @@ describe "Module#attr_reader" do
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
diff --git a/spec/ruby/core/module/attr_spec.rb b/spec/ruby/core/module/attr_spec.rb
index 9a469707a1..7128c610fe 100644
--- a/spec/ruby/core/module/attr_spec.rb
+++ b/spec/ruby/core/module/attr_spec.rb
@@ -143,7 +143,14 @@ describe "Module#attr" do
}.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
diff --git a/spec/ruby/core/module/attr_writer_spec.rb b/spec/ruby/core/module/attr_writer_spec.rb
index e1308d19bb..5979e3891b 100644
--- a/spec/ruby/core/module/attr_writer_spec.rb
+++ b/spec/ruby/core/module/attr_writer_spec.rb
@@ -58,7 +58,14 @@ describe "Module#attr_writer" do
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
diff --git a/spec/ruby/core/module/define_method_spec.rb b/spec/ruby/core/module/define_method_spec.rb
index 412a69a65a..64ac5306f0 100644
--- a/spec/ruby/core/module/define_method_spec.rb
+++ b/spec/ruby/core/module/define_method_spec.rb
@@ -357,8 +357,15 @@ describe "Module#define_method" do
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
diff --git a/spec/ruby/core/module/remove_method_spec.rb b/spec/ruby/core/module/remove_method_spec.rb
index f98cfa8daa..d82e0c65ca 100644
--- a/spec/ruby/core/module/remove_method_spec.rb
+++ b/spec/ruby/core/module/remove_method_spec.rb
@@ -20,8 +20,15 @@ describe "Module#remove_method" do
@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
diff --git a/spec/ruby/core/module/undef_method_spec.rb b/spec/ruby/core/module/undef_method_spec.rb
index 663ab2ffc8..54c3d37c7f 100644
--- a/spec/ruby/core/module/undef_method_spec.rb
+++ b/spec/ruby/core/module/undef_method_spec.rb
@@ -18,8 +18,15 @@ describe "Module#undef_method" do
@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