spec/moosex_spec.rb in moosex-0.0.16 vs spec/moosex_spec.rb in moosex-0.0.17
- old
+ new
@@ -1,17 +1,40 @@
require 'spec_helper'
require 'moosex'
class A
include MooseX
+
+ has :foo
+
+ has :bar, { doc: "bar..."}
end
+class B < A
+
+ has :bar, { doc: "new Bar... ", override: true }
+end
+
describe "MooseX" do
it "should contains has method" do
A.methods.include?(:has).should be_true
end
it "should be possible create one single instance" do
a = A.new
a.is_a?(A).should be_true
end
-end
\ No newline at end of file
+
+ it "A should has an attribute foo" do
+ a = A.new(foo: 1)
+ a.foo.should == 1
+ a.foo = 6
+ a.foo.should == 6
+ end
+
+ it "B should has an attribute foo" do
+ a = B.new(foo: 1)
+ a.foo.should == 1
+ a.foo = 6
+ a.foo.should == 6
+ end
+end