Improve spec

This commit is contained in:
Shinya Maeda 2017-07-04 01:51:21 +09:00
parent 17f34e5a74
commit bbbd5521d2
3 changed files with 11 additions and 11 deletions

View file

@ -47,11 +47,11 @@ describe Projects::PipelineSchedulesController do
end
describe 'GET #new' do
set(:user) { create(:user) }
before do
create(:user).tap do |user|
project.add_developer(user)
sign_in(user)
end
project.add_developer(user)
sign_in(user)
end
it 'initializes a pipeline schedule model' do
@ -64,11 +64,11 @@ describe Projects::PipelineSchedulesController do
describe 'POST #create' do
describe 'functionality' do
set(:user) { create(:user) }
before do
create(:user).tap do |user|
project.add_developer(user)
sign_in(user)
end
project.add_developer(user)
sign_in(user)
end
let(:basic_param) do
@ -188,7 +188,7 @@ describe Projects::PipelineSchedulesController do
describe 'PUT #update' do
describe 'functionality' do
let(:user) { create(:user) }
set(:user) { create(:user) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
before do
@ -397,7 +397,6 @@ describe Projects::PipelineSchedulesController do
before do
project.add_master(user)
sign_in(user)
end

View file

@ -1383,8 +1383,8 @@ describe Ci::Build, :models do
end
before do
pipeline_schedule.reload
pipeline_schedule.pipelines << pipeline
pipeline_schedule.reload
end
it { is_expected.to include(pipeline_schedule_variable.to_runner_variable) }

View file

@ -121,6 +121,7 @@ describe Ci::PipelineSchedule, models: true do
describe '#job_variables' do
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly) }
let!(:pipeline_schedule_variables) do
create_list(:ci_pipeline_schedule_variable, 2, pipeline_schedule: pipeline_schedule)
end