1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-07-27 12:40:09 +02:00
parent a06301b103
commit 5c276e1cc9
1247 changed files with 5316 additions and 5028 deletions

View file

@ -89,8 +89,8 @@ describe "Module#attr" do
attr :foo, true
end
lambda { c.new.foo }.should raise_error(NoMethodError)
lambda { c.new.foo=1 }.should raise_error(NoMethodError)
-> { c.new.foo }.should raise_error(NoMethodError)
-> { c.new.foo=1 }.should raise_error(NoMethodError)
end
it "creates a getter but no setter for all given attribute names" do
@ -120,8 +120,8 @@ describe "Module#attr" do
attr :foo, :bar
end
lambda { c.new.foo }.should raise_error(NoMethodError)
lambda { c.new.bar }.should raise_error(NoMethodError)
-> { c.new.foo }.should raise_error(NoMethodError)
-> { c.new.bar }.should raise_error(NoMethodError)
end
it "converts non string/symbol/fixnum names to strings using to_str" do
@ -131,13 +131,13 @@ describe "Module#attr" do
it "raises a TypeError when the given names can't be converted to strings using to_str" do
o = mock('o')
lambda { Class.new { attr o } }.should raise_error(TypeError)
-> { Class.new { attr o } }.should raise_error(TypeError)
(o = mock('123')).should_receive(:to_str).and_return(123)
lambda { Class.new { attr o } }.should raise_error(TypeError)
-> { Class.new { attr o } }.should raise_error(TypeError)
end
it "with a boolean argument emits a warning when $VERBOSE is true" do
lambda {
-> {
Class.new { attr :foo, true }
}.should complain(/boolean argument is obsoleted/, verbose: true)
end