Fix rubocop offenses in code related to pipelines

This commit is contained in:
Grzegorz Bizon 2016-12-15 13:41:46 +01:00
parent 01c8499a79
commit 70c0a76cad
2 changed files with 24 additions and 20 deletions

View file

@ -7,25 +7,32 @@ class Projects::PipelinesController < Projects::ApplicationController
def index
@scope = params[:scope]
@pipelines = PipelinesFinder.new(project).execute(scope: @scope).page(params[:page]).per(30)
@pipelines = PipelinesFinder
.new(project)
.execute(scope: @scope)
.page(params[:page])
.per(30)
@running_or_pending_count = PipelinesFinder.new(project).execute(scope: 'running').count
@pipelines_count = PipelinesFinder.new(project).execute.count
@running_or_pending_count = PipelinesFinder
.new(project).execute(scope: 'running').count
@pipelines_count = PipelinesFinder
.new(project).execute.count
respond_to do |format|
format.html
format.json do
render json: {
pipelines: PipelineSerializer
.new(project: @project, user: @current_user)
.with_pagination(request, response)
.represent(@pipelines),
updated_at: Time.now.utc,
count: {
all: @pipelines_count,
running_or_pending: @running_or_pending_count
}
}
render json: {
pipelines: PipelineSerializer
.new(project: @project, user: @current_user)
.with_pagination(request, response)
.represent(@pipelines),
updated_at: Time.now.utc,
count: {
all: @pipelines_count,
running_or_pending: @running_or_pending_count
}
}
end
end
end

View file

@ -271,12 +271,9 @@ describe "Pipelines", feature: true, js: true do
context 'with gitlab-ci.yml' do
before { stub_ci_pipeline_to_return_yaml_file }
it do
expect{
click_on 'Create pipeline'
}.to change{
Ci::Pipeline.count
}.by(1)
it 'creates a new pipeline' do
expect { click_on 'Create pipeline' }
.to change { Ci::Pipeline.count }.by(1)
end
end