-
Notifications
You must be signed in to change notification settings - Fork 896
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 #17896 from d-m-u/adding_ci_mixin
Add CiFeatureMixin
- Loading branch information
Showing
9 changed files
with
64 additions
and
61 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,5 @@ | ||
module CiFeatureMixin | ||
def retireable? | ||
true | ||
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
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
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
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,41 @@ | ||
describe CiFeatureMixin do | ||
let(:service) { FactoryGirl.create(:service) } | ||
describe "#retireable?" do | ||
it "vm is retireable" do | ||
FactoryGirl.create(:service_resource, :service => service, :resource => FactoryGirl.create(:vm)) | ||
|
||
expect(service.service_resources.first.resource.retireable?).to eq(true) | ||
end | ||
|
||
it "orchestration stack is retireable" do | ||
FactoryGirl.create(:service_resource, :service => service, :resource => FactoryGirl.create(:orchestration_stack_amazon)) | ||
|
||
expect(service.service_resources.first.resource.retireable?).to eq(true) | ||
end | ||
|
||
it "job not retireable" do | ||
FactoryGirl.create(:service_resource, :service => service, :resource => FactoryGirl.create(:embedded_ansible_job)) | ||
|
||
expect(service.service_resources.first.resource.retireable?).to eq(false) | ||
end | ||
|
||
context "service" do | ||
context "with type" do | ||
let(:service1) { FactoryGirl.create(:service_ansible_tower, :type => ServiceAnsibleTower) } | ||
it "is retireable" do | ||
FactoryGirl.create(:service_resource, :service => service, :resource => service1) | ||
|
||
expect(service.service_resources.first.resource.retireable?).to eq(true) | ||
end | ||
end | ||
|
||
context "without type" do | ||
it "is not retireable" do | ||
FactoryGirl.create(:service_resource, :service => service, :resource => FactoryGirl.create(:service)) | ||
|
||
expect(service.service_resources.first.resource.retireable?).to eq(false) | ||
end | ||
end | ||
end | ||
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