spec/requests/item_request_spec.rb in rubix-0.0.12 vs spec/requests/item_request_spec.rb in rubix-0.1.0

- old
+ new

@@ -20,39 +20,41 @@ it "returns nil on find" do Rubix::Item.find(:key => 'rubix.spec1', :host_id => @host_1.id).should be_nil end it "can be created" do - item = Rubix::Item.new(:key => 'rubix.spec1', :description => 'rubix item description 1', :host_id => @host_1.id, :value_type => :character, :applications => [@app_1]) + item = Rubix::Item.new(:key => 'rubix.spec1', :description => 'rubix item description 1', :host_id => @host_1.id, :value_type => :character, :applications => [@app_1], :units => 'B') item.save.should be_true item.host.name.should == @host_1.name item.applications.map(&:name).should include(@app_1.name) end end describe "when existing" do before do - @item = ensure_save(Rubix::Item.new(:key => 'rubix.spec1', :description => 'rubix item description 1', :host_id => @host_1.id, :value_type => :character, :applications => [@app_1])) + @item = ensure_save(Rubix::Item.new(:key => 'rubix.spec1', :description => 'rubix item description 1', :host_id => @host_1.id, :value_type => :character, :applications => [@app_1], :units => 'B')) end it "can have its host, application, and properties updated" do @item.key = 'rubix.spec2' @item.description = 'rubix item description 2' @item.type = :external @item.value_type = :unsigned_int @item.host_id = @host_2.id + @item.units = 'MB' @item.applications = [@app_2] @item.save.should be_true Rubix::Item.find(:key => 'rubix.spec1', :host_id => @host_1.id).should be_nil new_item = Rubix::Item.find(:key => 'rubix.spec2', :host_id => @host_2.id) new_item.should_not be_nil new_item.value_type.should == :unsigned_int new_item.type.should == :external new_item.host.name.should == @host_2.name + new_item.units.should == 'MB' new_item.applications.map(&:name).should include(@app_2.name) end it "can be destroyed" do @item.destroy