CI: RSpec tests for project controllers
We should add some of the project controllers tests at least to the extended
scope, but some fixes seem to be in order:
$ bin/rspec spec/controllers/projects/
(...)
Failures:
1) Projects::GroupLinksController#update when `expires_at` is set returns correct json response
Failure/Error: expect(json_response).to eq({ "expires_in" => "about 1 month", "expires_soon" => false })
expected: {"expires_in"=>"about 1 month", "expires_soon"=>false}
got: {"expires_in"=>"28 days", "expires_soon"=>false}
(compared using ==)
Diff:
@@ -1,3 +1,3 @@
-"expires_in" => "about 1 month",
+"expires_in" => "28 days",
"expires_soon" => false,
# ./spec/controllers/projects/group_links_controller_spec.rb:176:in `block (4 levels) in <main>'
# ./spec/spec_helper.rb:357:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:348:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (2 levels) in <top (required)>'
2) Projects::MergeRequestsController GET pipelines with private builds on a public project from a project fork with private builds for the target project member does not respond with serialized pipelines
Failure/Error: expect(json_response['pipelines']).to be_empty
expected `[{"active"=>true, "commit"=>{"author"=>nil, "author_email"=>"job@gitlab.com", "author_gravatar_url"=>...push", "triggered"=>[], "triggered_by"=>nil, "updated_at"=>"2021-02-08T15:15:50.560Z", "user"=>nil}].empty?` to return true, got false
# ./spec/controllers/projects/merge_requests_controller_spec.rb:792:in `block (7 levels) in <main>'
# ./spec/spec_helper.rb:357:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:348:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (2 levels) in <top (required)>'
# ./spec/support/sidekiq.rb:17:in `block (3 levels) in <main>'
# ./spec/support/sidekiq.rb:8:in `gitlab_sidekiq_inline'
# ./spec/support/sidekiq.rb:17:in `block (2 levels) in <main>'
3) Projects::ProjectMembersController PUT update expiration date when `expires_at` is set returns correct json response
Failure/Error:
expect(json_response).to eq({
"expires_in" => "about 1 month",
"expires_soon" => false,
"expires_at_formatted" => expiry_date.to_time.in_time_zone.to_s(:medium)
})
expected: {"expires_at_formatted"=>"Mar 7, 2021 11:00pm", "expires_in"=>"about 1 month", "expires_soon"=>false}
got: {"expires_at_formatted"=>"Mar 7, 2021 11:00pm", "expires_in"=>"28 days", "expires_soon"=>false}
(compared using ==)
Diff:
@@ -1,4 +1,4 @@
"expires_at_formatted" => "Mar 7, 2021 11:00pm",
-"expires_in" => "about 1 month",
+"expires_in" => "28 days",
"expires_soon" => false,
# ./spec/controllers/projects/project_members_controller_spec.rb:252:in `block (5 levels) in <main>'
# ./spec/spec_helper.rb:357:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:348:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (3 levels) in <top (required)>'
# ./spec/spec_helper.rb:344:in `block (2 levels) in <top (required)>'
Finished in 17 minutes 51 seconds (files took 24.37 seconds to load)
2697 examples, 3 failures, 6 pending
The ones about 28 days are mere annoyances, the one about the unwanted pipeline needs more attention.