Skip to content

Commit

Permalink
More specs for has and has_many
Browse files Browse the repository at this point in the history
  • Loading branch information
arunthampi committed Dec 3, 2007
1 parent ed8e9f5 commit 5cda02f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions trunk/spec/attributes_spec.rb
Expand Up @@ -17,6 +17,11 @@ class PersonWithTelephones < ActiveCouch::Base
it "should create an empty instance variable when sent #has with a symbol as parameter" do
@person.name.should == ""
end
it "should be able to assign a value to the instance variable defined using the has class method" do
@person.name.should == ""
@person.name = "John Doe"
@person.name.should == "John Doe"
end
end

describe "An object created as a subclass of ActiveCouch::Base with one text attribute (with default value set)" do
Expand All @@ -38,4 +43,11 @@ class PersonWithTelephones < ActiveCouch::Base
@person_with_tels.telephones.class.should == Array
@person_with_tels.telephones.size.should == 0
end

it "should be able to add a value to the array" do
@person_with_tels.telephones.size.should == 0
@person_with_tels.telephones << "123-456-789"
@person_with_tels.telephones.first.should == "123-456-789"
@person_with_tels.telephones.size.should == 1
end
end

0 comments on commit 5cda02f

Please sign in to comment.