spec/lib/hamster/immutable/new_spec.rb in hamster-1.0.1.pre.rc3 vs spec/lib/hamster/immutable/new_spec.rb in hamster-2.0.0
- old
+ new
@@ -9,6 +9,20 @@
let(:immutable) { NewPerson.new("Simon", "Harris") }
it "freezes the instance" do
expect(immutable).to be_frozen
end
+
+ context "subclass hides all public methods" do
+ it "freezes the instance" do
+ my_class = Class.new do
+ include Hamster::Immutable
+
+ (public_instance_methods - Object.public_instance_methods).each do |m|
+ protected m
+ end
+ end
+ immutable = my_class.new
+ expect(immutable).to be_frozen
+ end
+ end
end