1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2017-12-27 16:12:47 +00:00
parent 0f989b87a0
commit a34db218ad
162 changed files with 1267 additions and 621 deletions

View file

@ -49,9 +49,9 @@ describe "Module#alias_method" do
}
end
it "raises RuntimeError if frozen" do
it "raises #{frozen_error_class} if frozen" do
@class.freeze
lambda { @class.make_alias :uno, :public_one }.should raise_error(RuntimeError)
lambda { @class.make_alias :uno, :public_one }.should raise_error(frozen_error_class)
end
it "converts the names using #to_str" do

View file

@ -65,8 +65,8 @@ describe "Module#append_features" do
@other = Module.new.freeze
end
it "raises a RuntimeError before appending self" do
lambda { @receiver.send(:append_features, @other) }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} before appending self" do
lambda { @receiver.send(:append_features, @other) }.should raise_error(frozen_error_class)
@other.ancestors.should_not include(@receiver)
end
end

View file

@ -329,8 +329,8 @@ describe "Module#autoload" do
end
describe "on a frozen module" do
it "raises a RuntimeError before setting the name" do
lambda { @frozen_module.autoload :Foo, @non_existent }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} before setting the name" do
lambda { @frozen_module.autoload :Foo, @non_existent }.should raise_error(frozen_error_class)
@frozen_module.should_not have_constant(:Foo)
end
end

View file

@ -25,13 +25,13 @@ describe "Module#class_variable_set" do
c.send(:class_variable_get, "@@mvar").should == :new_mvar
end
it "raises a RuntimeError when self is frozen" do
it "raises a #{frozen_error_class} when self is frozen" do
lambda {
Class.new.freeze.send(:class_variable_set, :@@test, "test")
}.should raise_error(RuntimeError)
}.should raise_error(frozen_error_class)
lambda {
Module.new.freeze.send(:class_variable_set, :@@test, "test")
}.should raise_error(RuntimeError)
}.should raise_error(frozen_error_class)
end
it "raises a NameError when the given name is not allowed" do

View file

@ -78,8 +78,8 @@ describe "Module#const_set" do
@name = :Foo
end
it "raises a RuntimeError before setting the name" do
lambda { @frozen.const_set @name, nil }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} before setting the name" do
lambda { @frozen.const_set @name, nil }.should raise_error(frozen_error_class)
@frozen.should_not have_constant(@name)
end
end

View file

@ -247,10 +247,10 @@ describe "Module#define_method" do
lambda { obj.proc_style_test :arg }.should raise_error(ArgumentError)
end
it "raises a RuntimeError if frozen" do
it "raises a #{frozen_error_class} if frozen" do
lambda {
Class.new { freeze; define_method(:foo) {} }
}.should raise_error(RuntimeError)
}.should raise_error(frozen_error_class)
end
it "accepts a Method (still bound)" do

View file

@ -97,12 +97,12 @@ describe "Module#remove_method" do
@frozen = @module.dup.freeze
end
it "raises a RuntimeError when passed a name" do
lambda { @frozen.send :remove_method, :method_to_remove }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} when passed a name" do
lambda { @frozen.send :remove_method, :method_to_remove }.should raise_error(frozen_error_class)
end
it "raises a RuntimeError when passed a missing name" do
lambda { @frozen.send :remove_method, :not_exist }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} when passed a missing name" do
lambda { @frozen.send :remove_method, :not_exist }.should raise_error(frozen_error_class)
end
it "raises a TypeError when passed a not name" do

View file

@ -68,12 +68,12 @@ describe "Module#undef_method" do
@frozen = @module.dup.freeze
end
it "raises a RuntimeError when passed a name" do
lambda { @frozen.send :undef_method, :method_to_undef }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} when passed a name" do
lambda { @frozen.send :undef_method, :method_to_undef }.should raise_error(frozen_error_class)
end
it "raises a RuntimeError when passed a missing name" do
lambda { @frozen.send :undef_method, :not_exist }.should raise_error(RuntimeError)
it "raises a #{frozen_error_class} when passed a missing name" do
lambda { @frozen.send :undef_method, :not_exist }.should raise_error(frozen_error_class)
end
it "raises a TypeError when passed a not name" do