Commit 70c0a76c authored by Grzegorz Bizon's avatar Grzegorz Bizon

Fix rubocop offenses in code related to pipelines

parent 01c8499a
...@@ -7,25 +7,32 @@ class Projects::PipelinesController < Projects::ApplicationController ...@@ -7,25 +7,32 @@ class Projects::PipelinesController < Projects::ApplicationController
def index def index
@scope = params[:scope] @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 @running_or_pending_count = PipelinesFinder
@pipelines_count = PipelinesFinder.new(project).execute.count .new(project).execute(scope: 'running').count
@pipelines_count = PipelinesFinder
.new(project).execute.count
respond_to do |format| respond_to do |format|
format.html format.html
format.json do format.json do
render json: { render json: {
pipelines: PipelineSerializer pipelines: PipelineSerializer
.new(project: @project, user: @current_user) .new(project: @project, user: @current_user)
.with_pagination(request, response) .with_pagination(request, response)
.represent(@pipelines), .represent(@pipelines),
updated_at: Time.now.utc, updated_at: Time.now.utc,
count: { count: {
all: @pipelines_count, all: @pipelines_count,
running_or_pending: @running_or_pending_count running_or_pending: @running_or_pending_count
} }
} }
end end
end end
end end
......
...@@ -271,12 +271,9 @@ describe "Pipelines", feature: true, js: true do ...@@ -271,12 +271,9 @@ describe "Pipelines", feature: true, js: true do
context 'with gitlab-ci.yml' do context 'with gitlab-ci.yml' do
before { stub_ci_pipeline_to_return_yaml_file } before { stub_ci_pipeline_to_return_yaml_file }
it do it 'creates a new pipeline' do
expect{ expect { click_on 'Create pipeline' }
click_on 'Create pipeline' .to change { Ci::Pipeline.count }.by(1)
}.to change{
Ci::Pipeline.count
}.by(1)
end end
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