Commit 2f70f3fa authored by Shinya Maeda's avatar Shinya Maeda

Improve spec

parent 3acc9186
...@@ -47,12 +47,12 @@ describe Projects::PipelineSchedulesController do ...@@ -47,12 +47,12 @@ describe Projects::PipelineSchedulesController do
end end
describe 'GET #new' do describe 'GET #new' do
set(:user) { create(:user) }
before do before do
create(:user).tap do |user|
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
end end
end
it 'initializes a pipeline schedule model' do it 'initializes a pipeline schedule model' do
get :new, namespace_id: project.namespace.to_param, project_id: project get :new, namespace_id: project.namespace.to_param, project_id: project
...@@ -64,12 +64,12 @@ describe Projects::PipelineSchedulesController do ...@@ -64,12 +64,12 @@ describe Projects::PipelineSchedulesController do
describe 'POST #create' do describe 'POST #create' do
describe 'functionality' do describe 'functionality' do
set(:user) { create(:user) }
before do before do
create(:user).tap do |user|
project.add_developer(user) project.add_developer(user)
sign_in(user) sign_in(user)
end end
end
let(:basic_param) do let(:basic_param) do
{ description: 'aaaaaaaa', cron: '0 4 * * *', cron_timezone: 'UTC', ref: 'master', active: '1' } { description: 'aaaaaaaa', cron: '0 4 * * *', cron_timezone: 'UTC', ref: 'master', active: '1' }
...@@ -188,7 +188,7 @@ describe Projects::PipelineSchedulesController do ...@@ -188,7 +188,7 @@ describe Projects::PipelineSchedulesController do
describe 'PUT #update' do describe 'PUT #update' do
describe 'functionality' do describe 'functionality' do
let(:user) { create(:user) } set(:user) { create(:user) }
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) } let!(:pipeline_schedule) { create(:ci_pipeline_schedule, project: project, owner: user) }
before do before do
...@@ -397,7 +397,6 @@ describe Projects::PipelineSchedulesController do ...@@ -397,7 +397,6 @@ describe Projects::PipelineSchedulesController do
before do before do
project.add_master(user) project.add_master(user)
sign_in(user) sign_in(user)
end end
......
...@@ -1379,8 +1379,8 @@ describe Ci::Build, :models do ...@@ -1379,8 +1379,8 @@ describe Ci::Build, :models do
end end
before do before do
pipeline_schedule.reload
pipeline_schedule.pipelines << pipeline pipeline_schedule.pipelines << pipeline
pipeline_schedule.reload
end end
it { is_expected.to include(pipeline_schedule_variable.to_runner_variable) } it { is_expected.to include(pipeline_schedule_variable.to_runner_variable) }
......
...@@ -121,6 +121,7 @@ describe Ci::PipelineSchedule, models: true do ...@@ -121,6 +121,7 @@ describe Ci::PipelineSchedule, models: true do
describe '#job_variables' do describe '#job_variables' do
let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly) } let!(:pipeline_schedule) { create(:ci_pipeline_schedule, :nightly) }
let!(:pipeline_schedule_variables) do let!(:pipeline_schedule_variables) do
create_list(:ci_pipeline_schedule_variable, 2, pipeline_schedule: pipeline_schedule) create_list(:ci_pipeline_schedule_variable, 2, pipeline_schedule: pipeline_schedule)
end end
......
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