diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-20 13:26:24 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-12-20 13:26:24 +0300 |
commit | 5ec1c140d991b37d665c47e52dba4a453cc305a4 (patch) | |
tree | ce57dd152ea899fd79a3945467be9af1326ac8c2 /spec/models/ci | |
parent | 2b0b53cddd7d57ca5dd93437fdffefd7a07af91e (diff) |
Improve specs
Diffstat (limited to 'spec/models/ci')
-rw-r--r-- | spec/models/ci/pipeline_spec.rb | 14 | ||||
-rw-r--r-- | spec/models/ci/stage_spec.rb | 6 |
2 files changed, 13 insertions, 7 deletions
diff --git a/spec/models/ci/pipeline_spec.rb b/spec/models/ci/pipeline_spec.rb index 67cc3e6be68..5e1a9fa8dd8 100644 --- a/spec/models/ci/pipeline_spec.rb +++ b/spec/models/ci/pipeline_spec.rb @@ -179,15 +179,19 @@ describe Ci::Pipeline, models: true do subject { pipeline.stage('test') } context 'with status in stage' do - let!(:status) { create(:commit_status, pipeline: pipeline, stage: 'test') } - - it 'return stage object' do - is_expected.to be_a(Ci::Stage) + before do + create(:commit_status, pipeline: pipeline, stage: 'test') end + + it { expect(subject).to be_a(Ci::Stage) } + it { expect(subject.name).to eq('stage') } + it { expect(subject.statues).not_to be_empty } end context 'without status in stage' do - let!(:status) { create(:commit_status, pipeline: pipeline, stage: 'build') } + before do + create(:commit_status, pipeline: pipeline, stage: 'build') + end it 'return stage object' do is_expected.to be_nil diff --git a/spec/models/ci/stage_spec.rb b/spec/models/ci/stage_spec.rb index d8dce0f1cc6..65a302e9d9b 100644 --- a/spec/models/ci/stage_spec.rb +++ b/spec/models/ci/stage_spec.rb @@ -29,8 +29,10 @@ describe Ci::Stage, models: true do end describe '#statuses_count' do - let!(:stage_build) { create_job(:ci_build) } - let!(:other_build) { create_job(:ci_build, stage: 'other stage') } + before do + create_job(:ci_build) } + create_job(:ci_build, stage: 'other stage') + end subject { stage.statuses_count } |