File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,20 @@ class TrueClass
33
33
attr_accessor :spec_attr_accessor
34
34
end
35
35
36
- -> { true . spec_attr_accessor = "a" } . should raise_error ( RuntimeError )
36
+ -> { true . spec_attr_accessor = "a" } . should raise_error ( FrozenError )
37
+ end
38
+
39
+ it "raises FrozenError if the receiver if frozen" do
40
+ c = Class . new do
41
+ attr_accessor :foo
42
+ end
43
+ obj = c . new
44
+ obj . foo = 1
45
+ obj . foo . should == 1
46
+
47
+ obj . freeze
48
+ -> { obj . foo = 42 } . should raise_error ( FrozenError )
49
+ obj . foo . should == 1
37
50
end
38
51
39
52
it "converts non string/symbol names to strings using to_str" do
Original file line number Diff line number Diff line change @@ -29,7 +29,17 @@ class TrueClass
29
29
attr_writer :spec_attr_writer
30
30
end
31
31
32
- -> { true . spec_attr_writer = "a" } . should raise_error ( RuntimeError )
32
+ -> { true . spec_attr_writer = "a" } . should raise_error ( FrozenError )
33
+ end
34
+
35
+ it "raises FrozenError if the receiver if frozen" do
36
+ c = Class . new do
37
+ attr_writer :foo
38
+ end
39
+ obj = c . new
40
+ obj . freeze
41
+
42
+ -> { obj . foo = 42 } . should raise_error ( FrozenError )
33
43
end
34
44
35
45
it "converts non string/symbol names to strings using to_str" do
You can’t perform that action at this time.
0 commit comments