Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5496 from jrafanie/find_each_with_custom_select_n…
…eeds_primary_key find_each with a custom select needs the primary key
- Loading branch information
Showing
4 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FactoryGirl.define do | ||
factory :miq_cim_association do | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
FactoryGirl.define do | ||
factory :miq_cim_instance do | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require 'spec_helper' | ||
|
||
describe MiqCimInstance do | ||
before do | ||
@instance1 = FactoryGirl.create(:miq_cim_instance) | ||
attributes = { | ||
:result_instance => @instance1, | ||
:assoc_class => "A", | ||
:role => "B", | ||
:result_role => "C" | ||
} | ||
@cim_association = FactoryGirl.create(:miq_cim_association, attributes) | ||
@instance2 = FactoryGirl.create(:miq_cim_instance, :miq_cim_associations => [@cim_association]) | ||
end | ||
|
||
it "#getAssociators" do | ||
expect(@instance2.getAssociators(:AssocClass => "A", :Role => "B", :ResultRole => "C") | ||
.collect(&:id)) | ||
.to eq [@instance1.id] | ||
end | ||
|
||
it "#getAssociatedVmdbObjs" do | ||
host = FactoryGirl.create(:host) | ||
@instance1.update_attribute(:vmdb_obj, host) | ||
expect(@instance2.getAssociatedVmdbObjs(:AssocClass => "A", :Role => "B", :ResultRole => "C")) | ||
.to eq [host] | ||
end | ||
end |