Created
October 5, 2009 15:51
-
-
Save reinh/202201 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe Node do | |
describe 'attributes' do | |
before :each do | |
Node.generate! | |
@node = Node.new | |
end | |
it { should have_many(:node_class_memberships) } | |
it { should have_many(:node_classes).through(:node_class_memberships) } | |
it { should have_many(:node_group_memberships) } | |
it { should have_many(:node_groups).through(:node_group_memberships) } | |
it { should have_db_column(:name).of_type(:string) } | |
it { should validate_presence_of(:name) } | |
it { should validate_uniqueness_of(:name) } | |
it 'should allow setting and retrieving parameter values' do | |
@node.parameters = { :foo => 'bar' } | |
@node.parameters[:foo].should == 'bar' | |
end | |
it 'should preserve parameters as a hash across saving' do | |
@node = Node.generate!(:parameters => { :foo => 'bar'}) | |
Node.find(@node.id).parameters[:foo].should == 'bar' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment