Commit 5ec1c140 authored by Kamil Trzcinski's avatar Kamil Trzcinski

Improve specs

parent 2b0b53cd
...@@ -152,7 +152,7 @@ describe "Pipelines" do ...@@ -152,7 +152,7 @@ describe "Pipelines" do
end end
end end
describe 'GET /:project/pipelines/stage?name=stage' do describe 'GET /:project/pipelines/stage.json?name=stage' do
let!(:pipeline) do let!(:pipeline) do
create(:ci_empty_pipeline, project: project, ref: 'master', create(:ci_empty_pipeline, project: project, ref: 'master',
status: 'running') status: 'running')
...@@ -168,7 +168,10 @@ describe "Pipelines" do ...@@ -168,7 +168,10 @@ describe "Pipelines" do
project.namespace, project, pipeline, format: :json, stage: 'build') project.namespace, project, pipeline, format: :json, stage: 'build')
end end
it { expect(page).to have_http_status(:ok) } it do
expect(page).to have_http_status(:ok)
expect(JSON.parse(page.source)).to include("html")
end
end end
context 'when accessing unknown stage' do context 'when accessing unknown stage' do
......
...@@ -179,15 +179,19 @@ describe Ci::Pipeline, models: true do ...@@ -179,15 +179,19 @@ describe Ci::Pipeline, models: true do
subject { pipeline.stage('test') } subject { pipeline.stage('test') }
context 'with status in stage' do context 'with status in stage' do
let!(:status) { create(:commit_status, pipeline: pipeline, stage: 'test') } before do
create(:commit_status, pipeline: pipeline, stage: 'test')
it 'return stage object' do
is_expected.to be_a(Ci::Stage)
end 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 end
context 'without status in stage' do 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 it 'return stage object' do
is_expected.to be_nil is_expected.to be_nil
......
...@@ -29,8 +29,10 @@ describe Ci::Stage, models: true do ...@@ -29,8 +29,10 @@ describe Ci::Stage, models: true do
end end
describe '#statuses_count' do describe '#statuses_count' do
let!(:stage_build) { create_job(:ci_build) } before do
let!(:other_build) { create_job(:ci_build, stage: 'other stage') } create_job(:ci_build) }
create_job(:ci_build, stage: 'other stage')
end
subject { stage.statuses_count } subject { stage.statuses_count }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment