From 6901f42e1bfaab9a71d058d0ae134ca42d860c8d Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Tue, 1 Nov 2022 16:36:26 +0000 Subject: [PATCH 1/4] Update to Ruby 3.1, and all gems --- Dockerfile | 2 +- Gemfile | 2 +- Gemfile.lock | 306 ++++++++++++++++++++++----------------------- docker-compose.yml | 8 +- 4 files changed, 154 insertions(+), 164 deletions(-) diff --git a/Dockerfile b/Dockerfile index 96c471bde..0f03e9c81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM ruby:3.0.3 +FROM ruby:3.1 RUN apt-get update -qq && apt-get install -y nodejs postgresql-client WORKDIR /app COPY Gemfile /app/Gemfile diff --git a/Gemfile b/Gemfile index 69b7428cb..e17e0546f 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '3.0.3' +ruby '~> 3.1.0' gem 'aws-sdk-s3', require: false gem 'bootsnap', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 7580d75dc..84753d85d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,131 +1,132 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.0.2.4) - actionpack (= 7.0.2.4) - activesupport (= 7.0.2.4) + actioncable (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailbox (7.0.2.4) - actionpack (= 7.0.2.4) - activejob (= 7.0.2.4) - activerecord (= 7.0.2.4) - activestorage (= 7.0.2.4) - activesupport (= 7.0.2.4) + actionmailbox (7.0.4) + actionpack (= 7.0.4) + activejob (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.0.2.4) - actionpack (= 7.0.2.4) - actionview (= 7.0.2.4) - activejob (= 7.0.2.4) - activesupport (= 7.0.2.4) + actionmailer (7.0.4) + actionpack (= 7.0.4) + actionview (= 7.0.4) + activejob (= 7.0.4) + activesupport (= 7.0.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) - actionpack (7.0.2.4) - actionview (= 7.0.2.4) - activesupport (= 7.0.2.4) + actionpack (7.0.4) + actionview (= 7.0.4) + activesupport (= 7.0.4) 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.2.4) - actionpack (= 7.0.2.4) - activerecord (= 7.0.2.4) - activestorage (= 7.0.2.4) - activesupport (= 7.0.2.4) + actiontext (7.0.4) + actionpack (= 7.0.4) + activerecord (= 7.0.4) + activestorage (= 7.0.4) + activesupport (= 7.0.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.0.2.4) - activesupport (= 7.0.2.4) + actionview (7.0.4) + activesupport (= 7.0.4) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) - activejob (7.0.2.4) - activesupport (= 7.0.2.4) + activejob (7.0.4) + activesupport (= 7.0.4) globalid (>= 0.3.6) - activemodel (7.0.2.4) - activesupport (= 7.0.2.4) - activerecord (7.0.2.4) - activemodel (= 7.0.2.4) - activesupport (= 7.0.2.4) - activestorage (7.0.2.4) - actionpack (= 7.0.2.4) - activejob (= 7.0.2.4) - activerecord (= 7.0.2.4) - activesupport (= 7.0.2.4) + 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) marcel (~> 1.0) mini_mime (>= 1.1.0) - activesupport (7.0.2.4) + activesupport (7.0.4) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) - addressable (2.8.0) - public_suffix (>= 2.0.2, < 5.0) + addressable (2.8.1) + public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) aws-eventstream (1.2.0) - aws-partitions (1.567.0) - aws-sdk-core (3.130.0) + aws-partitions (1.654.0) + aws-sdk-core (3.166.0) aws-eventstream (~> 1, >= 1.0.2) - aws-partitions (~> 1, >= 1.525.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.5) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.59.0) + aws-sdk-core (~> 3, >= 3.165.0) aws-sigv4 (~> 1.1) - jmespath (~> 1.0) - aws-sdk-kms (1.55.0) - aws-sdk-core (~> 3, >= 3.127.0) - aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.113.0) - aws-sdk-core (~> 3, >= 3.127.0) + aws-sdk-s3 (1.117.1) + aws-sdk-core (~> 3, >= 3.165.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.4) - aws-sigv4 (1.4.0) + aws-sigv4 (1.5.2) aws-eventstream (~> 1, >= 1.0.2) - bootsnap (1.9.3) - msgpack (~> 1.0) + bootsnap (1.13.0) + msgpack (~> 1.2) builder (3.2.4) byebug (11.1.3) - cancancan (3.3.0) + cancancan (3.4.0) coderay (1.1.3) concurrent-ruby (1.1.10) crack (0.4.5) rexml crass (1.0.6) - diff-lcs (1.4.4) - digest (3.1.0) + diff-lcs (1.5.0) docile (1.4.0) - dotenv (2.7.6) - dotenv-rails (2.7.6) - dotenv (= 2.7.6) + dotenv (2.8.1) + dotenv-rails (2.8.1) + dotenv (= 2.8.1) railties (>= 3.2) - erubi (1.10.0) - factory_bot (6.2.0) + erubi (1.11.0) + factory_bot (6.2.1) activesupport (>= 5.0.0) factory_bot_rails (6.2.0) factory_bot (~> 6.2.0) railties (>= 5.0.0) - faker (2.19.0) - i18n (>= 1.6, < 2) - faraday (2.2.0) - faraday-net_http (~> 2.0) + faker (2.23.0) + i18n (>= 1.8.11, < 2) + faraday (2.6.0) + faraday-net_http (>= 2.0, < 3.1) ruby2_keywords (>= 0.0.4) - faraday-net_http (2.0.1) + faraday-net_http (3.0.1) globalid (1.0.0) activesupport (>= 5.0) hashdiff (1.0.1) - i18n (1.10.0) + i18n (1.12.0) concurrent-ruby (~> 1.0) - importmap-rails (1.0.1) + importmap-rails (1.1.5) actionpack (>= 6.0.0) railties (>= 6.0.0) - jbuilder (2.11.4) + jbuilder (2.11.5) + actionview (>= 5.0.0) activesupport (>= 5.0.0) jmespath (1.6.1) - loofah (2.16.0) + json (2.6.2) + loofah (2.19.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) @@ -133,118 +134,113 @@ GEM marcel (1.0.2) method_source (1.0.0) mini_mime (1.1.2) - minitest (5.15.0) - msgpack (1.4.2) - net-imap (0.2.3) - digest + minitest (5.16.3) + msgpack (1.6.0) + net-imap (0.3.1) net-protocol - strscan - net-pop (0.1.1) - digest + net-pop (0.1.2) net-protocol - timeout net-protocol (0.1.3) timeout - net-smtp (0.3.1) - digest + net-smtp (0.3.3) net-protocol - timeout nio4r (2.5.8) - nokogiri (1.13.4-aarch64-linux) + nokogiri (1.13.9-aarch64-linux) racc (~> 1.4) - nokogiri (1.13.4-x86_64-darwin) + nokogiri (1.13.9-x86_64-darwin) racc (~> 1.4) - nokogiri (1.13.4-x86_64-linux) + nokogiri (1.13.9-x86_64-linux) racc (~> 1.4) - parallel (1.21.0) - parser (3.0.3.2) + parallel (1.22.1) + parser (3.1.2.1) ast (~> 2.4.1) - pg (1.2.3) - pry (0.13.1) + pg (1.4.4) + pry (0.14.1) coderay (~> 1.1) method_source (~> 1.0) - pry-byebug (3.9.0) + pry-byebug (3.10.1) byebug (~> 11.0) - pry (~> 0.13.0) - public_suffix (4.0.6) - puma (5.6.4) + pry (>= 0.13, < 0.15) + public_suffix (5.0.0) + puma (5.6.5) nio4r (~> 2.0) racc (1.6.0) - rack (2.2.3) + rack (2.2.4) rack-cors (1.1.1) rack (>= 2.0.0) - rack-test (1.1.0) - rack (>= 1.0, < 3) - rails (7.0.2.4) - actioncable (= 7.0.2.4) - actionmailbox (= 7.0.2.4) - actionmailer (= 7.0.2.4) - actionpack (= 7.0.2.4) - actiontext (= 7.0.2.4) - actionview (= 7.0.2.4) - activejob (= 7.0.2.4) - activemodel (= 7.0.2.4) - activerecord (= 7.0.2.4) - activestorage (= 7.0.2.4) - activesupport (= 7.0.2.4) + 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) bundler (>= 1.15.0) - railties (= 7.0.2.4) + railties (= 7.0.4) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.4.2) + rails-html-sanitizer (1.4.3) loofah (~> 2.3) - railties (7.0.2.4) - actionpack (= 7.0.2.4) - activesupport (= 7.0.2.4) + railties (7.0.4) + actionpack (= 7.0.4) + activesupport (= 7.0.4) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) - rainbow (3.0.0) + rainbow (3.1.1) rake (13.0.6) - regexp_parser (2.2.0) + regexp_parser (2.6.0) rexml (3.2.5) - rspec (3.10.0) - rspec-core (~> 3.10.0) - rspec-expectations (~> 3.10.0) - rspec-mocks (~> 3.10.0) - rspec-core (3.10.1) - rspec-support (~> 3.10.0) - rspec-expectations (3.10.1) + 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-support (~> 3.12.0) + rspec-expectations (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-mocks (3.10.2) + rspec-support (~> 3.12.0) + rspec-mocks (3.12.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.10.0) - rspec-rails (5.0.2) - actionpack (>= 5.2) - activesupport (>= 5.2) - railties (>= 5.2) - rspec-core (~> 3.10) - rspec-expectations (~> 3.10) - rspec-mocks (~> 3.10) - rspec-support (~> 3.10) - rspec-support (3.10.3) - rspec_junit_formatter (0.5.1) + rspec-support (~> 3.12.0) + rspec-rails (6.0.1) + actionpack (>= 6.1) + activesupport (>= 6.1) + railties (>= 6.1) + rspec-core (~> 3.11) + rspec-expectations (~> 3.11) + rspec-mocks (~> 3.11) + rspec-support (~> 3.11) + rspec-support (3.12.0) + rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.23.0) + rubocop (1.38.0) + json (~> 2.3) parallel (~> 1.10) - parser (>= 3.0.0.0) + parser (>= 3.1.2.1) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 1.8, < 3.0) - rexml - rubocop-ast (>= 1.12.0, < 2.0) + rexml (>= 3.2.5, < 4.0) + rubocop-ast (>= 1.23.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.15.0) - parser (>= 3.0.1.1) - rubocop-rails (2.13.2) + rubocop-ast (1.23.0) + parser (>= 3.1.1.0) + rubocop-rails (2.17.2) activesupport (>= 4.2.0) rack (>= 1.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-rspec (2.8.0) - rubocop (~> 1.19) + rubocop (>= 1.33.0, < 2.0) + rubocop-rspec (2.14.2) + rubocop (~> 1.33) ruby-progressbar (1.11.0) ruby2_keywords (0.0.5) sentry-rails (5.5.0) @@ -252,40 +248,40 @@ GEM sentry-ruby (~> 5.5.0) sentry-ruby (5.5.0) concurrent-ruby (~> 1.0, >= 1.0.2) - shoulda-matchers (5.0.0) + shoulda-matchers (5.2.0) activesupport (>= 5.2.0) simplecov (0.21.2) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-html (0.12.3) - simplecov_json_formatter (0.1.3) - sprockets (4.0.2) + simplecov_json_formatter (0.1.4) + sprockets (4.1.1) concurrent-ruby (~> 1.0) rack (> 1, < 3) sprockets-rails (3.4.2) actionpack (>= 5.2) activesupport (>= 5.2) sprockets (>= 3.0.0) - stimulus-rails (1.0.2) + stimulus-rails (1.1.1) railties (>= 6.0.0) - strscan (3.0.1) thor (1.2.1) - timeout (0.2.0) - turbo-rails (1.0.0) + timeout (0.3.0) + turbo-rails (1.3.2) actionpack (>= 6.0.0) + activejob (>= 6.0.0) railties (>= 6.0.0) - tzinfo (2.0.4) + tzinfo (2.0.5) concurrent-ruby (~> 1.0) - unicode-display_width (2.1.0) - webmock (3.14.0) + unicode-display_width (2.3.0) + webmock (3.18.1) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) websocket-driver (0.7.5) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) - zeitwerk (2.5.4) + zeitwerk (2.6.3) PLATFORMS aarch64-linux @@ -322,7 +318,7 @@ DEPENDENCIES webmock RUBY VERSION - ruby 3.0.3p157 + ruby 3.1.2p20 BUNDLED WITH - 2.2.32 + 2.3.24 diff --git a/docker-compose.yml b/docker-compose.yml index ad84cf096..6b84c144e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,19 +2,16 @@ version: "3.9" services: db: image: postgres:14.1 - command: postgres -c listen_addresses='*' environment: - POSTGRES_USER - POSTGRES_PASSWORD - POSTGRES_DB - ports: - - "5434:5432" + web: build: . command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3009 -b '0.0.0.0'" volumes: - .:/app - - bundle:/usr/local/bundle ports: - "3009:3009" depends_on: @@ -22,6 +19,3 @@ services: stdin_open: true tty: true -volumes: - pg-data: null - bundle: null From 545b2d1d5bc9e0b9a2688367046ca39a1a0812cd Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Tue, 1 Nov 2022 16:39:26 +0000 Subject: [PATCH 2/4] Update circleci images --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e5107ac2..4bc645c65 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,7 +1,7 @@ jobs: rubocop: docker: - - image: 'cimg/ruby:3.0.3' + - image: 'cimg/ruby:3.1' steps: - checkout - ruby/install-deps @@ -11,7 +11,7 @@ jobs: test: docker: - - image: 'cimg/ruby:3.0.3-browsers' + - image: 'cimg/ruby:3.1-browsers' - image: 'circleci/postgres:12.0-alpine-ram' environment: POSTGRES_DB: choco_cake_test From 88f68533e093b1602c621f75be9eec20654ad613 Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Fri, 18 Nov 2022 17:47:06 +0000 Subject: [PATCH 3/4] Rubocop --- app/controllers/api/default_projects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/default_projects_controller.rb b/app/controllers/api/default_projects_controller.rb index 0692594b6..2c66609f8 100644 --- a/app/controllers/api/default_projects_controller.rb +++ b/app/controllers/api/default_projects_controller.rb @@ -48,7 +48,7 @@ def python_project def html_project content = <<~CON - \n \n \n + \n \n \n \n

Heading

\n

Paragraph

\n \n CON From 3d2da909277c97d005c7004a8164f92a6258985a Mon Sep 17 00:00:00 2001 From: "Patrick J. Cherry" Date: Fri, 18 Nov 2022 17:49:45 +0000 Subject: [PATCH 4/4] More rubocopping --- spec/factories/project.rb | 2 +- spec/models/component_spec.rb | 2 +- spec/models/project_spec.rb | 2 +- spec/request/projects/create_spec.rb | 6 +++--- spec/request/projects/destroy_spec.rb | 6 +++--- spec/request/projects/images_spec.rb | 8 ++++---- spec/request/projects/index_spec.rb | 4 ++-- spec/request/projects/remix_spec.rb | 8 ++++---- spec/request/projects/show_spec.rb | 4 ++-- spec/request/projects/update_spec.rb | 8 ++++---- 10 files changed, 25 insertions(+), 25 deletions(-) diff --git a/spec/factories/project.rb b/spec/factories/project.rb index d3551c11f..889671c13 100644 --- a/spec/factories/project.rb +++ b/spec/factories/project.rb @@ -27,7 +27,7 @@ trait :with_attached_image do after(:build) do |object| - object.images.attach(io: File.open(Rails.root.join('spec/fixtures/files/test_image_1.png')), + object.images.attach(io: Rails.root.join('spec/fixtures/files/test_image_1.png').open, filename: 'test_image', content_type: 'image/png') end diff --git a/spec/models/component_spec.rb b/spec/models/component_spec.rb index ebb180b12..308465152 100644 --- a/spec/models/component_spec.rb +++ b/spec/models/component_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Component, type: :model do +RSpec.describe Component do subject { build(:component) } it { is_expected.to belong_to(:project) } diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index 672554100..f8baab59e 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -2,7 +2,7 @@ require 'rails_helper' -RSpec.describe Project, type: :model do +RSpec.describe Project do describe 'associations' do it { is_expected.to have_many(:components) } it { is_expected.to have_many(:remixes).dependent(:nullify) } diff --git a/spec/request/projects/create_spec.rb b/spec/request/projects/create_spec.rb index 3b56d583f..2821be829 100644 --- a/spec/request/projects/create_spec.rb +++ b/spec/request/projects/create_spec.rb @@ -19,7 +19,7 @@ it 'returns success' do post '/api/projects' - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end end @@ -34,14 +34,14 @@ it 'returns error' do post '/api/projects' - expect(response.status).to eq(500) + expect(response).to have_http_status(:internal_server_error) end end context 'when no auth user' do it 'returns unauthorized' do post '/api/projects' - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/spec/request/projects/destroy_spec.rb b/spec/request/projects/destroy_spec.rb index 9ce87207d..271e6fb1c 100644 --- a/spec/request/projects/destroy_spec.rb +++ b/spec/request/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}" - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end it "deletes user's project" do @@ -30,7 +30,7 @@ it 'returns forbidden' do delete "/api/projects/#{non_owned_project.identifier}" - expect(response.status).to eq(403) + expect(response).to have_http_status(:forbidden) end end end @@ -38,7 +38,7 @@ context 'when no user' do it 'returns unauthorized' do delete '/api/projects/project-identifier' - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/spec/request/projects/images_spec.rb b/spec/request/projects/images_spec.rb index 132887ae3..4b4f6b70c 100644 --- a/spec/request/projects/images_spec.rb +++ b/spec/request/projects/images_spec.rb @@ -37,13 +37,13 @@ it 'returns success response' do post "/api/projects/#{project.identifier}/images", params: params - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end it 'returns 404 response if invalid project' do post '/api/projects/no-such-project/images' - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end @@ -54,7 +54,7 @@ it 'returns forbidden response' do post "/api/projects/#{project.identifier}/images", params: params - expect(response.status).to eq(403) + expect(response).to have_http_status(:forbidden) end end @@ -62,7 +62,7 @@ it 'returns unauthorized' do post "/api/projects/#{project.identifier}/images" - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/spec/request/projects/index_spec.rb b/spec/request/projects/index_spec.rb index 7c51c672d..279e9e5a7 100644 --- a/spec/request/projects/index_spec.rb +++ b/spec/request/projects/index_spec.rb @@ -18,7 +18,7 @@ it 'returns success response' do get '/api/projects' - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end it 'returns correct number of projects' do @@ -37,7 +37,7 @@ context 'when no user' do it 'returns unauthorized' do get '/api/projects' - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/spec/request/projects/remix_spec.rb b/spec/request/projects/remix_spec.rb index 430d43e93..359a56544 100644 --- a/spec/request/projects/remix_spec.rb +++ b/spec/request/projects/remix_spec.rb @@ -27,14 +27,14 @@ it 'returns success response' do post "/api/projects/#{original_project.identifier}/remix", params: { project: project_params } - expect(response.status).to eq(200) + 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 } - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end @@ -49,7 +49,7 @@ it 'returns 400' do post "/api/projects/#{original_project.identifier}/remix", params: { project: project_params } - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end it 'returns error message' do @@ -63,7 +63,7 @@ it 'returns unauthorized' do post "/api/projects/#{original_project.identifier}/remix" - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end diff --git a/spec/request/projects/show_spec.rb b/spec/request/projects/show_spec.rb index 90df52a09..ebdf9c4aa 100644 --- a/spec/request/projects/show_spec.rb +++ b/spec/request/projects/show_spec.rb @@ -18,7 +18,7 @@ it 'returns success response' do get "/api/projects/#{project.identifier}" - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end it 'returns json' do @@ -34,6 +34,6 @@ it 'returns 404 response if invalid project' do get '/api/projects/no-such-project' - expect(response.status).to eq(404) + expect(response).to have_http_status(:not_found) end end diff --git a/spec/request/projects/update_spec.rb b/spec/request/projects/update_spec.rb index 68ef58f39..0930a7ab0 100644 --- a/spec/request/projects/update_spec.rb +++ b/spec/request/projects/update_spec.rb @@ -34,7 +34,7 @@ it 'returns success response' do put "/api/projects/#{project.identifier}", params: params - expect(response.status).to eq(200) + expect(response).to have_http_status(:ok) end it 'returns updated project json' do @@ -55,7 +55,7 @@ it 'returns error response' do put "/api/projects/#{project.identifier}", params: params - expect(response.status).to eq(400) + expect(response).to have_http_status(:bad_request) end end end @@ -70,7 +70,7 @@ it 'returns forbidden response' do put "/api/projects/#{project.identifier}", params: params - expect(response.status).to eq(403) + expect(response).to have_http_status(:forbidden) end end @@ -78,7 +78,7 @@ it 'returns unauthorized' do put "/api/projects/#{project.identifier}" - expect(response.status).to eq(401) + expect(response).to have_http_status(:unauthorized) end end end