Skip to content

Commit

Permalink
Test build methods do not duplicate InventoryObject
Browse files Browse the repository at this point in the history
Test build methods do not duplicate InventoryObject
  • Loading branch information
Ladas committed Feb 21, 2018
1 parent af89c45 commit c4bd67c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions spec/models/manager_refresh/persister/finders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,16 @@
expect(hardware_lazy_1.reference.full_reference).to eq(:vm_or_template => vm_lazy)
expect(hardware_lazy_2.reference.full_reference).to eq hardware_lazy_2.reference.full_reference
end

it "checks build finds existing inventory object instead of duplicating" do
expect(persister.vms.build(vm_data(1)).object_id).to eq(persister.vms.build(vm_data(1)).object_id)
end

it "checks find_or_build finds existing inventory object instead of duplicating" do
expect(persister.vms.find_or_build(vm_data(1)).object_id).to eq(persister.vms.find_or_build(vm_data(1)).object_id)
end

it "checks find_or_build_by finds existing inventory object instead of duplicating" do
expect(persister.vms.find_or_build_by(vm_data(1)).object_id).to eq(persister.vms.find_or_build_by(vm_data(1)).object_id)
end
end

0 comments on commit c4bd67c

Please sign in to comment.