-
Notifications
You must be signed in to change notification settings - Fork 438
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 #5211 from bgeuken/tests_for_staging_projects
Tests for staging projects
- Loading branch information
Showing
2 changed files
with
48 additions
and
15 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,42 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe ObsFactory::StagingProject do | ||
let(:distribution) { ObsFactory::Distribution.new(create(:project, name: 'openSUSE:Factory')) } | ||
|
||
describe '::find' do | ||
subject { ObsFactory::StagingProject.find(distribution, '42') } | ||
|
||
context 'when there is a matching project' do | ||
let!(:project) { create(:project, name: "openSUSE:Factory:Staging:42") } | ||
|
||
it 'returns the staging project' do | ||
is_expected.to be_kind_of ObsFactory::StagingProject | ||
expect(subject.name).to eq 'openSUSE:Factory:Staging:42' | ||
expect(subject.project).to eq project | ||
expect(subject.distribution).to eq distribution | ||
end | ||
end | ||
|
||
context 'when there is no matching project' do | ||
it { is_expected.to be_nil } | ||
end | ||
end | ||
|
||
describe '#adi_staging?' do | ||
let(:project) { create(:project, name: "openSUSE:Factory:Staging:adi:42") } | ||
|
||
subject { ObsFactory::StagingProject.new(project: project, distribution: distribution) } | ||
|
||
context "when the project name includes 'Staging:adi'" do | ||
let(:project) { create(:project, name: "openSUSE:Factory:Staging:adi:42") } | ||
|
||
it { expect(subject.adi_staging?).to be true } | ||
end | ||
|
||
context "when the project name does not include 'Staging:adi'" do | ||
let(:project) { create(:project, name: "openSUSE:Factory:Staging:42") } | ||
|
||
it { expect(subject.adi_staging?).to be false } | ||
end | ||
end | ||
end |