Skip to content

Commit

Permalink
[ci] Add test for StagingProject::find
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Jun 26, 2018
1 parent 50c4158 commit 1ea5aeb
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/api/spec/models/obs_factory/staging_project_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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
end

0 comments on commit 1ea5aeb

Please sign in to comment.