test/inheritable_attr_test.rb in uber-0.0.10 vs test/inheritable_attr_test.rb in uber-0.0.11
- old
+ new
@@ -5,13 +5,18 @@
describe "::inheritable_attr" do
subject {
Class.new(Object) do
extend Uber::InheritableAttribute
inheritable_attr :drinks
+ inheritable_attr :glass
end
}
+ def assert_nothing_raised(*)
+ yield
+ end
+
it "provides a reader with empty inherited attributes, already" do
assert_equal nil, subject.drinks
end
it "provides a reader with empty inherited attributes in a derived class" do
@@ -47,8 +52,29 @@
subject.drinks = [:cabernet]
subklass = Class.new(subject)
subklass.drinks = [:merlot] # we only want merlot explicitely.
assert_equal [:merlot], subklass.drinks # no :cabernet, here
+ end
+
+ it "does not attempt to clone symbols" do
+ subject.glass = :highball
+ subklass = Class.new(subject)
+
+ subklass.glass.must_equal :highball
+ end
+
+ it "does not attempt to clone true" do
+ subject.glass = true
+ subklass = Class.new(subject)
+
+ subklass.glass.must_equal true
+ end
+
+ it "does not attempt to clone false" do
+ subject.glass = false
+ subklass = Class.new(subject)
+
+ subklass.glass.must_equal false
end
end
end