spec/hooks_spec.rb in moosex-0.0.13 vs spec/hooks_spec.rb in moosex-0.0.14
- old
+ new
@@ -78,10 +78,11 @@
after :clear! do |object|
object.z = 0
end
end
+
describe "OtherPoint3D" do
it "should clear a 3d point" do
p = OtherPoint3D.new(x: 1, y: 2, z: 3)
p.x.should == 1
p.y.should == 2
@@ -91,6 +92,32 @@
p.x.should == 0
p.y.should == 0
p.z.should == 0
end
-end
+end
+
+class OtherPoint4D < OtherPoint3D
+
+ has t: { is: :rw, required: true }
+
+ after :clear! do |object|
+ object.t = 0
+ end
+end
+
+describe "OtherPoint4D" do
+ it "should clear a 3d point" do
+ p = OtherPoint4D.new(x: 1, y: 2, z: 3, t: 4)
+ p.x.should == 1
+ p.y.should == 2
+ p.z.should == 3
+ p.t.should == 4
+
+ p.clear!
+
+ p.x.should == 0
+ p.y.should == 0
+ p.z.should == 0
+ p.t.should == 0
+ end
+end
\ No newline at end of file