diff --git a/.circleci/config.yml b/.circleci/config.yml index 54e2b462..1fde01d9 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ jobs: rubocop: docker: - - image: 'cimg/ruby:3.1' + - image: 'cimg/ruby:3.2' steps: - checkout - ruby/install-deps @@ -11,7 +11,7 @@ jobs: test: docker: - - image: 'cimg/ruby:3.1-browsers' + - image: 'cimg/ruby:3.2-browsers' - image: 'circleci/postgres:12.0-alpine-ram' environment: POSTGRES_DB: choco_cake_test diff --git a/.ruby-version b/.ruby-version index 7bde84d0..72b3400f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -ruby-3.1.2 +ruby-3.2.1 diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..40b87ee4 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +ruby 3.2.1 diff --git a/Dockerfile b/Dockerfile index 9d6f83f9..c8f2da89 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.1-slim-bullseye as base +FROM ruby:3.2-slim-bullseye as base RUN gem install bundler \ && apt-get update \ && apt-get upgrade --yes \ diff --git a/Gemfile b/Gemfile index 8577c167..d426ae6e 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '~> 3.1.0' +ruby '~> 3.2.0' gem 'aws-sdk-s3', require: false gem 'bootsnap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 1263f345..c7497da4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,67 +1,67 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + actioncable (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actionmailbox (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.4) - actionpack (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activesupport (= 7.0.4) + actionmailer (7.0.4.2) + actionpack (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activesupport (= 7.0.4.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.4) - actionview (= 7.0.4) - activesupport (= 7.0.4) + actionpack (7.0.4.2) + actionview (= 7.0.4.2) + activesupport (= 7.0.4.2) rack (~> 2.0, >= 2.2.0) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) - actiontext (7.0.4) - actionpack (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + actiontext (7.0.4.2) + actionpack (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.4) - activesupport (= 7.0.4) + actionview (7.0.4.2) + activesupport (= 7.0.4.2) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.4) - activesupport (= 7.0.4) + activejob (7.0.4.2) + activesupport (= 7.0.4.2) globalid (>= 0.3.6) - activemodel (7.0.4) - activesupport (= 7.0.4) - activerecord (7.0.4) - activemodel (= 7.0.4) - activesupport (= 7.0.4) - activestorage (7.0.4) - actionpack (= 7.0.4) - activejob (= 7.0.4) - activerecord (= 7.0.4) - activesupport (= 7.0.4) + activemodel (7.0.4.2) + activesupport (= 7.0.4.2) + activerecord (7.0.4.2) + activemodel (= 7.0.4.2) + activesupport (= 7.0.4.2) + activestorage (7.0.4.2) + actionpack (= 7.0.4.2) + activejob (= 7.0.4.2) + activerecord (= 7.0.4.2) + activesupport (= 7.0.4.2) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.4) + activesupport (7.0.4.2) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -70,29 +70,29 @@ GEM public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.674.0) - aws-sdk-core (3.168.4) + aws-partitions (1.718.0) + aws-sdk-core (3.170.0) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) jmespath (~> 1, >= 1.6.1) - aws-sdk-kms (1.61.0) + aws-sdk-kms (1.63.0) aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.117.2) + aws-sdk-s3 (1.119.1) aws-sdk-core (~> 3, >= 3.165.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) - bootsnap (1.15.0) + bootsnap (1.16.0) msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) cancancan (3.4.0) climate_control (1.2.0) coderay (1.1.3) - concurrent-ruby (1.2.0) + concurrent-ruby (1.2.2) crack (0.4.5) rexml crass (1.0.6) @@ -103,7 +103,7 @@ GEM dotenv-rails (2.8.1) dotenv (= 2.8.1) railties (>= 3.2) - erubi (1.11.0) + erubi (1.12.0) et-orbi (1.2.7) tzinfo factory_bot (6.2.1) @@ -111,9 +111,9 @@ GEM factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (3.0.0) + faker (3.1.1) i18n (>= 1.8.11, < 2) - faraday (2.7.1) + faraday (2.7.4) faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) faraday-net_http (3.0.2) @@ -126,7 +126,7 @@ GEM railties (>= 4) globalid (1.1.0) activesupport (>= 5.0) - good_job (3.12.1) + good_job (3.12.6) activejob (>= 6.0.0) activerecord (>= 6.0.0) concurrent-ruby (>= 1.0.2) @@ -148,7 +148,7 @@ GEM actionview (>= 5.0.0) activesupport (>= 5.0.0) jmespath (1.6.2) - json (2.6.2) + json (2.6.3) kaminari (1.2.2) activesupport (>= 4.1.0) kaminari-actionview (= 1.2.2) @@ -164,90 +164,94 @@ GEM loofah (2.19.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) - mail (2.7.1) + mail (2.8.1) mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) minitest (5.17.0) msgpack (1.6.0) - net-imap (0.3.1) + net-imap (0.3.4) + date net-protocol net-pop (0.1.2) net-protocol - net-protocol (0.1.3) + net-protocol (0.2.1) timeout net-smtp (0.3.3) net-protocol nio4r (2.5.8) - nokogiri (1.14.1-aarch64-linux) + nokogiri (1.14.2-aarch64-linux) racc (~> 1.4) - nokogiri (1.14.1-x86_64-linux) + nokogiri (1.14.2-x86_64-linux) racc (~> 1.4) open-uri (0.3.0) stringio time uri parallel (1.22.1) - parser (3.1.3.0) + parser (3.2.1.0) ast (~> 2.4.1) - pg (1.4.5) - pry (0.14.1) + pg (1.4.6) + pry (0.14.2) coderay (~> 1.1) method_source (~> 1.0) pry-byebug (3.10.1) byebug (~> 11.0) pry (>= 0.13, < 0.15) - public_suffix (5.0.0) + public_suffix (5.0.1) puma (5.6.5) nio4r (~> 2.0) raabro (1.4.0) racc (1.6.2) rack (2.2.6.2) - rack-cors (1.1.1) + rack-cors (2.0.0) rack (>= 2.0.0) rack-test (2.0.2) rack (>= 1.3) - rails (7.0.4) - actioncable (= 7.0.4) - actionmailbox (= 7.0.4) - actionmailer (= 7.0.4) - actionpack (= 7.0.4) - actiontext (= 7.0.4) - actionview (= 7.0.4) - activejob (= 7.0.4) - activemodel (= 7.0.4) - activerecord (= 7.0.4) - activestorage (= 7.0.4) - activesupport (= 7.0.4) + rails (7.0.4.2) + actioncable (= 7.0.4.2) + actionmailbox (= 7.0.4.2) + actionmailer (= 7.0.4.2) + actionpack (= 7.0.4.2) + actiontext (= 7.0.4.2) + actionview (= 7.0.4.2) + activejob (= 7.0.4.2) + activemodel (= 7.0.4.2) + activerecord (= 7.0.4.2) + activestorage (= 7.0.4.2) + activesupport (= 7.0.4.2) bundler (>= 1.15.0) - railties (= 7.0.4) + railties (= 7.0.4.2) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) rails-html-sanitizer (1.5.0) loofah (~> 2.19, >= 2.19.1) - railties (7.0.4) - actionpack (= 7.0.4) - activesupport (= 7.0.4) + railties (7.0.4.2) + actionpack (= 7.0.4.2) + activesupport (= 7.0.4.2) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.6.1) + regexp_parser (2.7.0) rexml (3.2.5) rspec (3.12.0) rspec-core (~> 3.12.0) rspec-expectations (~> 3.12.0) rspec-mocks (~> 3.12.0) - rspec-core (3.12.0) + rspec-core (3.12.1) rspec-support (~> 3.12.0) - rspec-expectations (3.12.0) + rspec-expectations (3.12.2) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) - rspec-mocks (3.12.0) + rspec-mocks (3.12.3) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.12.0) rspec-rails (6.0.1) @@ -261,26 +265,29 @@ GEM rspec-support (3.12.0) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.39.0) + rubocop (1.47.0) json (~> 2.3) parallel (~> 1.10) - parser (>= 3.1.2.1) + parser (>= 3.2.0.0) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) rexml (>= 3.2.5, < 4.0) - rubocop-ast (>= 1.23.0, < 2.0) + rubocop-ast (>= 1.26.0, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.23.0) - parser (>= 3.1.1.0) - rubocop-graphql (0.19.0) + unicode-display_width (>= 2.4.0, < 3.0) + rubocop-ast (1.27.0) + parser (>= 3.2.1.0) + rubocop-capybara (2.17.1) + rubocop (~> 1.41) + rubocop-graphql (1.0.0) rubocop (>= 0.87, < 2) - rubocop-rails (2.17.3) + rubocop-rails (2.18.0) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) - rubocop-rspec (2.15.0) + rubocop-rspec (2.18.1) rubocop (~> 1.33) + rubocop-capybara (~> 2.17) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) sentry-rails (5.5.0) @@ -288,7 +295,7 @@ GEM sentry-ruby (~> 5.5.0) sentry-ruby (5.5.0) concurrent-ruby (~> 1.0, >= 1.0.2) - shoulda-matchers (5.2.0) + shoulda-matchers (5.3.0) activesupport (>= 5.2.0) simplecov (0.22.0) docile (~> 1.1) @@ -300,10 +307,10 @@ GEM thor (1.2.1) time (0.2.1) date - timeout (0.3.0) + timeout (0.3.2) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.3.0) + unicode-display_width (2.4.2) uri (0.12.0) webmock (3.18.1) addressable (>= 2.8.0) @@ -313,7 +320,7 @@ GEM websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.6.6) + zeitwerk (2.6.7) PLATFORMS aarch64-linux @@ -355,7 +362,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.1.3p185 + ruby 3.2.1p31 BUNDLED WITH - 2.3.26 + 2.4.7 diff --git a/app/jobs/upload_job.rb b/app/jobs/upload_job.rb index 0a8a8e10..f45c4dd6 100644 --- a/app/jobs/upload_job.rb +++ b/app/jobs/upload_job.rb @@ -5,7 +5,7 @@ require 'github_api' class UploadJob < ApplicationJob - ProjectContentQuery = GithubApi::Client.parse <<-'GRAPHQL' + ProjectContentQuery = GithubApi::Client.parse <<-GRAPHQL query($owner: String!, $repository: String!, $expression: String!) { repository(owner: $owner, name: $repository) { object(expression: $expression) { diff --git a/config/environments/production.rb b/config/environments/production.rb index 79d5c864..45fbc454 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -68,7 +68,7 @@ config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" diff --git a/spec/requests/projects/create_spec.rb b/spec/requests/projects/create_spec.rb index 43ba6bd8..fa1f23a7 100644 --- a/spec/requests/projects/create_spec.rb +++ b/spec/requests/projects/create_spec.rb @@ -19,7 +19,7 @@ end it 'returns success' do - post '/api/projects', headers: headers + post('/api/projects', headers:) expect(response).to have_http_status(:ok) end @@ -35,7 +35,7 @@ end it 'returns error' do - post '/api/projects', headers: headers + post('/api/projects', headers:) expect(response).to have_http_status(:internal_server_error) end diff --git a/spec/requests/projects/destroy_spec.rb b/spec/requests/projects/destroy_spec.rb index 958b7db7..1ef10bfe 100644 --- a/spec/requests/projects/destroy_spec.rb +++ b/spec/requests/projects/destroy_spec.rb @@ -15,7 +15,7 @@ context 'when deleting a project the user owns' do it 'returns success' do - delete "/api/projects/#{project.identifier}", headers: headers + delete("/api/projects/#{project.identifier}", headers:) expect(response).to have_http_status(:ok) end @@ -31,7 +31,7 @@ let(:non_owned_project) { create(:project) } it 'returns forbidden' do - delete "/api/projects/#{non_owned_project.identifier}", headers: headers + delete("/api/projects/#{non_owned_project.identifier}", headers:) expect(response).to have_http_status(:forbidden) end diff --git a/spec/requests/projects/images_spec.rb b/spec/requests/projects/images_spec.rb index 795c0e58..d656e067 100644 --- a/spec/requests/projects/images_spec.rb +++ b/spec/requests/projects/images_spec.rb @@ -31,19 +31,19 @@ end it 'returns file list' do - post "/api/projects/#{project.identifier}/images", params: params, headers: headers + post("/api/projects/#{project.identifier}/images", params:, headers:) expect(response.body).to eq(expected_json) end it 'returns success response' do - post "/api/projects/#{project.identifier}/images", params: params, headers: headers + post("/api/projects/#{project.identifier}/images", params:, headers:) expect(response).to have_http_status(:ok) end it 'returns 404 response if invalid project' do - post '/api/projects/no-such-project/images', headers: headers + post('/api/projects/no-such-project/images', headers:) expect(response).to have_http_status(:not_found) end @@ -57,14 +57,14 @@ end it 'returns forbidden response' do - post "/api/projects/#{project.identifier}/images", params: params, headers: headers + post("/api/projects/#{project.identifier}/images", params:, headers:) expect(response).to have_http_status(:forbidden) end end context 'when auth token is missing' do it 'returns unauthorized' do - post "/api/projects/#{project.identifier}/images", headers: headers + post("/api/projects/#{project.identifier}/images", headers:) expect(response).to have_http_status(:unauthorized) end diff --git a/spec/requests/projects/index_spec.rb b/spec/requests/projects/index_spec.rb index 9c2051da..5a8bd673 100644 --- a/spec/requests/projects/index_spec.rb +++ b/spec/requests/projects/index_spec.rb @@ -21,25 +21,25 @@ end it 'returns success response' do - get '/api/projects', headers: headers + get('/api/projects', headers:) expect(response).to have_http_status(:ok) end it 'returns correct number of projects' do - get '/api/projects', headers: headers - returned = JSON.parse(response.body) + get('/api/projects', headers:) + returned = response.parsed_body expect(returned.length).to eq(2) end it 'returns users projects' do - get '/api/projects', headers: headers - returned = JSON.parse(response.body) + get('/api/projects', headers:) + returned = response.parsed_body expect(returned.all? { |proj| proj['user_id'] == user_id }).to be(true) end it 'returns all keys in response' do - get '/api/projects', headers: headers - returned = JSON.parse(response.body) + get('/api/projects', headers:) + returned = response.parsed_body returned.each { |project| expect(project.keys).to eq(project_keys) } end end @@ -51,14 +51,14 @@ end it 'returns the default number of projects on the first page' do - get '/api/projects', headers: headers - returned = JSON.parse(response.body) + get('/api/projects', headers:) + returned = response.parsed_body expect(returned.length).to eq(8) end it 'returns the next set of projects on the next page' do - get '/api/projects?page=2', headers: headers - returned = JSON.parse(response.body) + get('/api/projects?page=2', headers:) + returned = response.parsed_body expect(returned.length).to eq(4) end @@ -67,7 +67,7 @@ next_link = page_links(2, 'next') expected_link_header = [last_link, next_link].join(', ') - get '/api/projects', headers: headers + get('/api/projects', headers:) expect(response.headers['Link']).to eq expected_link_header end @@ -76,7 +76,7 @@ prev_link = page_links(1, 'prev') expected_link_header = [first_link, prev_link].join(', ') - get '/api/projects?page=2', headers: headers + get('/api/projects?page=2', headers:) expect(response.headers['Link']).to eq expected_link_header end end diff --git a/spec/requests/projects/remix_spec.rb b/spec/requests/projects/remix_spec.rb index fd3b8a29..34c3ee62 100644 --- a/spec/requests/projects/remix_spec.rb +++ b/spec/requests/projects/remix_spec.rb @@ -25,14 +25,14 @@ end it 'returns success response' do - post "/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers: headers + post("/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers:) expect(response).to have_http_status(:ok) end it 'returns 404 response if invalid project' do project_params[:identifier] = 'no-such-project' - post '/api/projects/no-such-project/remix', params: { project: project_params }, headers: headers + post('/api/projects/no-such-project/remix', params: { project: project_params }, headers:) expect(response).to have_http_status(:not_found) end @@ -46,13 +46,13 @@ end it 'returns 400' do - post "/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers: headers + post("/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers:) expect(response).to have_http_status(:bad_request) end it 'returns error message' do - post "/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers: headers + post("/api/projects/#{original_project.identifier}/remix", params: { project: project_params }, headers:) expect(response.body).to eq({ error: 'Something went wrong' }.to_json) end diff --git a/spec/requests/projects/show_spec.rb b/spec/requests/projects/show_spec.rb index dc65dc6b..a98cfce8 100644 --- a/spec/requests/projects/show_spec.rb +++ b/spec/requests/projects/show_spec.rb @@ -25,18 +25,18 @@ context 'when loading own project' do it 'returns success response' do - get "/api/projects/#{project.identifier}", headers: headers + get("/api/projects/#{project.identifier}", headers:) expect(response).to have_http_status(:ok) end it 'returns json' do - get "/api/projects/#{project.identifier}", headers: headers + get("/api/projects/#{project.identifier}", headers:) expect(response.content_type).to eq('application/json; charset=utf-8') end it 'returns the project json' do - get "/api/projects/#{project.identifier}", headers: headers + get("/api/projects/#{project.identifier}", headers:) expect(response.body).to eq(project_json) end end @@ -55,13 +55,13 @@ end it 'returns forbidden response' do - get "/api/projects/#{another_project.identifier}", headers: headers + get("/api/projects/#{another_project.identifier}", headers:) expect(response).to have_http_status(:forbidden) end it 'does not return the project json' do - get "/api/projects/#{another_project.identifier}", headers: headers + get("/api/projects/#{another_project.identifier}", headers:) expect(response.body).not_to include(another_project_json) end end @@ -82,36 +82,36 @@ end it 'returns success response' do - get "/api/projects/#{starter_project.identifier}", headers: headers + get("/api/projects/#{starter_project.identifier}", headers:) expect(response).to have_http_status(:ok) end it 'returns json' do - get "/api/projects/#{starter_project.identifier}", headers: headers + get("/api/projects/#{starter_project.identifier}", headers:) expect(response.content_type).to eq('application/json; charset=utf-8') end it 'returns the project json' do - get "/api/projects/#{starter_project.identifier}", headers: headers + get("/api/projects/#{starter_project.identifier}", headers:) expect(response.body).to eq(starter_project_json) end it 'returns 404 response if invalid project' do - get '/api/projects/no-such-project', headers: headers + get('/api/projects/no-such-project', headers:) expect(response).to have_http_status(:not_found) end end context 'when loading an owned project' do it 'returns forbidden response' do - get "/api/projects/#{project.identifier}", headers: headers + get("/api/projects/#{project.identifier}", headers:) expect(response).to have_http_status(:forbidden) end it 'does not return the project json' do - get "/api/projects/#{project.identifier}", headers: headers + get("/api/projects/#{project.identifier}", headers:) expect(response.body).not_to include(project_json) end end diff --git a/spec/requests/projects/update_spec.rb b/spec/requests/projects/update_spec.rb index 7b0b1496..35f7bc91 100644 --- a/spec/requests/projects/update_spec.rb +++ b/spec/requests/projects/update_spec.rb @@ -32,12 +32,12 @@ end it 'returns success response' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response).to have_http_status(:ok) end it 'returns updated project json' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response.body).to include('updated component content') end @@ -45,7 +45,7 @@ mock_response = instance_double(OperationResponse) allow(mock_response).to receive(:success?).and_return(true) allow(Project::Update).to receive(:call).and_return(mock_response) - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(Project::Update).to have_received(:call) end @@ -53,17 +53,17 @@ let(:params) { { project: { name: 'updated project name' } } } it 'returns success response' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response).to have_http_status(:ok) end it 'returns json with updated project properties' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response.body).to include('updated project name') end it 'returns json with previous project components' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response.body).to include(project.components.first.attributes[:content].to_s) end end @@ -72,7 +72,7 @@ let(:params) { { project: { components: [] } } } it 'returns error response' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response).to have_http_status(:bad_request) end end @@ -87,7 +87,7 @@ end it 'returns forbidden response' do - put "/api/projects/#{project.identifier}", params: params, headers: headers + put("/api/projects/#{project.identifier}", params:, headers:) expect(response).to have_http_status(:forbidden) end end @@ -100,7 +100,7 @@ end it 'returns unauthorized' do - put "/api/projects/#{project.identifier}", headers: headers + put("/api/projects/#{project.identifier}", headers:) expect(response).to have_http_status(:unauthorized) end