From 53bc163dbe081f3ada4314c26d77b292ed3c70a6 Mon Sep 17 00:00:00 2001 From: Eliot Jordan Date: Thu, 13 Oct 2016 17:01:25 -0500 Subject: [PATCH] update to rails 5 --- .rubocop.yml | 8 ++ Gemfile | 3 +- Gemfile.lock | 107 ++++++++++--------- bin/spring | 2 +- circle.yml | 1 + config/application.rb | 2 - config/environments/production.rb | 2 +- config/environments/test.rb | 5 +- db/schema.rb | 91 +++++++--------- spec/controllers/catalog_controller_spec.rb | 6 +- spec/controllers/exhibits_controller_spec.rb | 24 ++--- spec/controllers/pages_controller_spec.rb | 2 +- spec/rails_helper.rb | 2 + 13 files changed, 124 insertions(+), 131 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index db0bb3be..b263a973 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -35,6 +35,9 @@ Metrics/ClassLength: Metrics/MethodLength: Enabled: false +Metrics/BlockLength: + Max: 28 + Style/BlockDelimiters: Exclude: - 'spec/**/*' @@ -101,6 +104,11 @@ Rails/Date: Rails/TimeZone: Enabled: false +Rails/DynamicFindBy: + Exclude: + - 'app/controllers/exhibits_controller.rb' + - 'app/decorators/applies_title_from_slug.rb' + RSpec/ExampleWording: CustomTransform: be: is diff --git a/Gemfile b/Gemfile index 5ae06782..79f2ad97 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.2.7.1' +gem 'rails', '5.0.0.1' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use SCSS for stylesheets @@ -50,6 +50,7 @@ group :development, :test do gem 'capistrano-passenger' gem 'capistrano-rails-console' gem 'database_cleaner' + gem 'rails-controller-testing' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index 74bbc6db..8ded4c23 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -7,7 +7,7 @@ GIT GIT remote: git://github.com/pulibrary/pul_assets.git - revision: afaa2495a4579c4c6154cb672106d2fad15438ac + revision: 84dc633f5ff39167b4f7e7acf2517fffda630f0f specs: pul-assets (0.2.2) bourbon (~> 4.2.6) @@ -37,40 +37,42 @@ GIT GEM remote: https://rubygems.org/ specs: - actionmailer (4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) + actioncable (5.0.0.1) + actionpack (= 5.0.0.1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.7.1) - actionview (= 4.2.7.1) - activesupport (= 4.2.7.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.0.1) + actionview (= 5.0.0.1) + activesupport (= 5.0.0.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.7.1) - activesupport (= 4.2.7.1) + actionview (5.0.0.1) + activesupport (= 5.0.0.1) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.7.1) - activesupport (= 4.2.7.1) - globalid (>= 0.3.0) - activemodel (4.2.7.1) - activesupport (= 4.2.7.1) - builder (~> 3.1) - activerecord (4.2.7.1) - activemodel (= 4.2.7.1) - activesupport (= 4.2.7.1) - arel (~> 6.0) - activesupport (4.2.7.1) + activejob (5.0.0.1) + activesupport (= 5.0.0.1) + globalid (>= 0.3.6) + activemodel (5.0.0.1) + activesupport (= 5.0.0.1) + activerecord (5.0.0.1) + activemodel (= 5.0.0.1) + activesupport (= 5.0.0.1) + arel (~> 7.0) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) acts-as-taggable-on (4.0.0) activerecord (>= 4.0) @@ -80,7 +82,7 @@ GEM almond-rails (0.0.3) rails (>= 4.2, < 6) amq-protocol (2.0.1) - arel (6.0.3) + arel (7.1.4) ast (2.3.0) autoprefixer-rails (6.5.1) execjs @@ -283,6 +285,7 @@ GEM net-scp (1.2.1) net-ssh (>= 2.6.5) net-ssh (3.2.0) + nio4r (1.2.1) nokogiri (1.6.8.1) mini_portile2 (~> 2.1.0) normalize-rails (3.0.3) @@ -323,33 +326,36 @@ GEM pry (~> 0.10) pry-rails (0.3.4) pry (>= 0.9.10) - rack (1.6.4) + rack (2.0.1) rack-protection (1.5.3) rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.7.1) - actionmailer (= 4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) - activemodel (= 4.2.7.1) - activerecord (= 4.2.7.1) - activesupport (= 4.2.7.1) + rails (5.0.0.1) + actioncable (= 5.0.0.1) + actionmailer (= 5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + activemodel (= 5.0.0.1) + activerecord (= 5.0.0.1) + activesupport (= 5.0.0.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.7.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) + railties (= 5.0.0.1) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.1) + actionpack (~> 5.x) + actionview (~> 5.x) + activesupport (~> 5.x) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.7.1) - actionpack (= 4.2.7.1) - activesupport (= 4.2.7.1) + railties (5.0.0.1) + actionpack (= 5.0.0.1) + activesupport (= 5.0.0.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rainbow (2.1.0) @@ -393,7 +399,7 @@ GEM rspec-mocks (~> 3.5.0) rspec-support (~> 3.5.0) rspec-support (3.5.0) - rubocop (0.43.0) + rubocop (0.44.1) parser (>= 2.3.1.1, < 3.0) powerpack (~> 0.1) rainbow (>= 1.99.1, < 3.0) @@ -556,7 +562,8 @@ DEPENDENCIES pry-rails pul-assets! pul_uv_rails! - rails (= 4.2.7.1) + rails (= 5.0.0.1) + rails-controller-testing redis-namespace rsolr (~> 1.0.6) rspec-rails diff --git a/bin/spring b/bin/spring index 62ec28f8..4e9d144a 100755 --- a/bin/spring +++ b/bin/spring @@ -8,7 +8,7 @@ unless defined?(Spring) require 'bundler' if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) - Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq } + Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(File::PATH_SEPARATOR) } gem 'spring', match[1] require 'spring/binstub' end diff --git a/circle.yml b/circle.yml index ab19e833..b1f8a98e 100644 --- a/circle.yml +++ b/circle.yml @@ -13,6 +13,7 @@ dependencies: - npm install -g eslint post: - sudo sh bin/ci_kakadu_install.sh + - bundle exec rails db:migrate RAILS_ENV=test - bundle exec rake pomegranate:server: background: true - bin/jetty_wait diff --git a/config/application.rb b/config/application.rb index a5ff5179..001dd533 100644 --- a/config/application.rb +++ b/config/application.rb @@ -25,8 +25,6 @@ class Application < Rails::Application # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de - # Do not swallow errors in after_commit/after_rollback callbacks. - config.active_record.raise_in_transactional_callbacks = true config.autoload_paths += %W(#{Rails.root}/app/workers) end end diff --git a/config/environments/production.rb b/config/environments/production.rb index 536d8aa3..564d55bc 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -22,7 +22,7 @@ # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = true + config.public_file_server.enabled = true # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier diff --git a/config/environments/test.rb b/config/environments/test.rb index 1c19f08b..82af12f6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,8 +13,8 @@ config.eager_load = false # Configure static file server for tests with Cache-Control for performance. - config.serve_static_files = true - config.static_cache_control = 'public, max-age=3600' + config.public_file_server.enabled = true + config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } # Show full error reports and disable caching. config.consider_all_requests_local = true @@ -39,4 +39,5 @@ # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + config.active_job.queue_adapter = :inline end diff --git a/db/schema.rb b/db/schema.rb index 8aeb1040..7184a3ba 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1,4 +1,3 @@ -# encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. @@ -21,34 +20,31 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "document_type" + t.index ["document_type", "document_id"], name: "index_bookmarks_on_document_type_and_document_id" + t.index ["user_id"], name: "index_bookmarks_on_user_id" end - add_index "bookmarks", ["document_type", "document_id"], name: "index_bookmarks_on_document_type_and_document_id" - add_index "bookmarks", ["user_id"], name: "index_bookmarks_on_user_id" - create_table "friendly_id_slugs", force: :cascade do |t| t.string "slug", null: false t.integer "sluggable_id", null: false t.string "sluggable_type", limit: 50 t.string "scope" t.datetime "created_at" + t.index ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true + t.index ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" + t.index ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" + t.index ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" end - add_index "friendly_id_slugs", ["slug", "sluggable_type", "scope"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type_and_scope", unique: true - add_index "friendly_id_slugs", ["slug", "sluggable_type"], name: "index_friendly_id_slugs_on_slug_and_sluggable_type" - add_index "friendly_id_slugs", ["sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_id" - add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type" - create_table "searches", force: :cascade do |t| t.text "query_params" t.integer "user_id" t.string "user_type" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["user_id"], name: "index_searches_on_user_id" end - add_index "searches", ["user_id"], name: "index_searches_on_user_id" - create_table "spotlight_attachments", force: :cascade do |t| t.string "name" t.string "file" @@ -84,11 +80,10 @@ t.string "unconfirmed_email" t.datetime "created_at" t.datetime "updated_at" + t.index ["confirmation_token"], name: "index_spotlight_contact_emails_on_confirmation_token", unique: true + t.index ["email", "exhibit_id"], name: "index_spotlight_contact_emails_on_email_and_exhibit_id", unique: true end - add_index "spotlight_contact_emails", ["confirmation_token"], name: "index_spotlight_contact_emails_on_confirmation_token", unique: true - add_index "spotlight_contact_emails", ["email", "exhibit_id"], name: "index_spotlight_contact_emails_on_email_and_exhibit_id", unique: true - create_table "spotlight_contacts", force: :cascade do |t| t.string "slug" t.string "name" @@ -107,10 +102,9 @@ t.integer "avatar_crop_y" t.integer "avatar_crop_w" t.integer "avatar_crop_h" + t.index ["exhibit_id"], name: "index_spotlight_contacts_on_exhibit_id" end - add_index "spotlight_contacts", ["exhibit_id"], name: "index_spotlight_contacts_on_exhibit_id" - create_table "spotlight_custom_fields", force: :cascade do |t| t.integer "exhibit_id" t.string "slug" @@ -137,11 +131,10 @@ t.integer "thumbnail_id" t.integer "weight", default: 50 t.integer "site_id" + t.index ["site_id"], name: "index_spotlight_exhibits_on_site_id" + t.index ["slug"], name: "index_spotlight_exhibits_on_slug", unique: true end - add_index "spotlight_exhibits", ["site_id"], name: "index_spotlight_exhibits_on_site_id" - add_index "spotlight_exhibits", ["slug"], name: "index_spotlight_exhibits_on_slug", unique: true - create_table "spotlight_featured_images", force: :cascade do |t| t.string "type" t.boolean "display" @@ -162,10 +155,9 @@ t.integer "exhibit_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["exhibit_id"], name: "index_spotlight_filters_on_exhibit_id" end - add_index "spotlight_filters", ["exhibit_id"], name: "index_spotlight_filters_on_exhibit_id" - create_table "spotlight_locks", force: :cascade do |t| t.integer "on_id" t.string "on_type" @@ -173,10 +165,9 @@ t.string "by_type" t.datetime "created_at" t.datetime "updated_at" + t.index ["on_id", "on_type"], name: "index_spotlight_locks_on_on_id_and_on_type", unique: true end - add_index "spotlight_locks", ["on_id", "on_type"], name: "index_spotlight_locks_on_on_id_and_on_type", unique: true - create_table "spotlight_main_navigations", force: :cascade do |t| t.string "label" t.integer "weight", default: 20 @@ -185,10 +176,9 @@ t.datetime "created_at" t.datetime "updated_at" t.boolean "display", default: true + t.index ["exhibit_id"], name: "index_spotlight_main_navigations_on_exhibit_id" end - add_index "spotlight_main_navigations", ["exhibit_id"], name: "index_spotlight_main_navigations_on_exhibit_id" - create_table "spotlight_pages", force: :cascade do |t| t.string "title" t.string "type" @@ -206,12 +196,11 @@ t.boolean "display_sidebar" t.boolean "display_title" t.integer "thumbnail_id" + t.index ["exhibit_id"], name: "index_spotlight_pages_on_exhibit_id" + t.index ["parent_page_id"], name: "index_spotlight_pages_on_parent_page_id" + t.index ["slug", "scope"], name: "index_spotlight_pages_on_slug_and_scope", unique: true end - add_index "spotlight_pages", ["exhibit_id"], name: "index_spotlight_pages_on_exhibit_id" - add_index "spotlight_pages", ["parent_page_id"], name: "index_spotlight_pages_on_parent_page_id" - add_index "spotlight_pages", ["slug", "scope"], name: "index_spotlight_pages_on_slug_and_scope", unique: true - create_table "spotlight_resources", force: :cascade do |t| t.integer "exhibit_id" t.string "type" @@ -222,19 +211,17 @@ t.datetime "updated_at" t.binary "metadata" t.integer "index_status" + t.index ["index_status"], name: "index_spotlight_resources_on_index_status" end - add_index "spotlight_resources", ["index_status"], name: "index_spotlight_resources_on_index_status" - create_table "spotlight_roles", force: :cascade do |t| t.integer "user_id" t.string "role" t.integer "resource_id" t.string "resource_type" + t.index ["resource_type", "resource_id", "user_id"], name: "index_spotlight_roles_on_resource_and_user_id", unique: true end - add_index "spotlight_roles", ["resource_type", "resource_id", "user_id"], name: "index_spotlight_roles_on_resource_and_user_id", unique: true - create_table "spotlight_searches", force: :cascade do |t| t.string "title" t.string "slug" @@ -251,11 +238,10 @@ t.integer "masthead_id" t.integer "thumbnail_id" t.string "default_index_view_type" + t.index ["exhibit_id"], name: "index_spotlight_searches_on_exhibit_id" + t.index ["slug", "scope"], name: "index_spotlight_searches_on_slug_and_scope", unique: true end - add_index "spotlight_searches", ["exhibit_id"], name: "index_spotlight_searches_on_exhibit_id" - add_index "spotlight_searches", ["slug", "scope"], name: "index_spotlight_searches_on_slug_and_scope", unique: true - create_table "spotlight_sites", force: :cascade do |t| t.string "title" t.string "subtitle" @@ -273,11 +259,10 @@ t.integer "resource_id" t.string "resource_type" t.binary "index_status" + t.index ["exhibit_id"], name: "index_spotlight_solr_document_sidecars_on_exhibit_id" + t.index ["resource_type", "resource_id"], name: "spotlight_solr_document_sidecars_resource" end - add_index "spotlight_solr_document_sidecars", ["exhibit_id"], name: "index_spotlight_solr_document_sidecars_on_exhibit_id" - add_index "spotlight_solr_document_sidecars", ["resource_type", "resource_id"], name: "spotlight_solr_document_sidecars_resource" - create_table "taggings", force: :cascade do |t| t.integer "tag_id" t.integer "taggable_id" @@ -286,18 +271,16 @@ t.string "tagger_type" t.string "context", limit: 128 t.datetime "created_at" + t.index ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true + t.index ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" end - add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true - add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context" - create_table "tags", force: :cascade do |t| t.string "name" t.integer "taggings_count", default: 0 + t.index ["name"], name: "index_tags_on_name", unique: true end - add_index "tags", ["name"], name: "index_tags_on_name", unique: true - create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -323,17 +306,16 @@ t.string "provider" t.string "uid" t.string "username" + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["invitation_token"], name: "index_users_on_invitation_token", unique: true + t.index ["invitations_count"], name: "index_users_on_invitations_count" + t.index ["invited_by_id"], name: "index_users_on_invited_by_id" + t.index ["provider"], name: "index_users_on_provider" + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["uid"], name: "index_users_on_uid" + t.index ["username"], name: "index_users_on_username" end - add_index "users", ["email"], name: "index_users_on_email", unique: true - add_index "users", ["invitation_token"], name: "index_users_on_invitation_token", unique: true - add_index "users", ["invitations_count"], name: "index_users_on_invitations_count" - add_index "users", ["invited_by_id"], name: "index_users_on_invited_by_id" - add_index "users", ["provider"], name: "index_users_on_provider" - add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true - add_index "users", ["uid"], name: "index_users_on_uid" - add_index "users", ["username"], name: "index_users_on_username" - create_table "versions", force: :cascade do |t| t.string "item_type", null: false t.integer "item_id", null: false @@ -341,8 +323,7 @@ t.string "whodunnit" t.text "object", limit: 1073741823 t.datetime "created_at" + t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" end - add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id" - end diff --git a/spec/controllers/catalog_controller_spec.rb b/spec/controllers/catalog_controller_spec.rb index 207c4be7..67c6951e 100644 --- a/spec/controllers/catalog_controller_spec.rb +++ b/spec/controllers/catalog_controller_spec.rb @@ -8,7 +8,7 @@ resource = IIIFResource.new manifest_url: url, exhibit: exhibit expect(resource.save_and_index).to be_truthy - get :index, q: "", exhibit_id: exhibit.id + get :index, params: { q: "", exhibit_id: exhibit.id } expect(document_ids).to eq [resource.document_builder.to_solr.to_a.first[:id]] end @@ -17,7 +17,7 @@ resource = IIIFResource.new manifest_url: url, exhibit: exhibit expect(resource.save_and_index).to be_truthy - get :index, q: "SR1", exhibit_id: exhibit.id + get :index, params: { q: "SR1", exhibit_id: exhibit.id } expect(document_ids).to eq [resource.document_builder.to_solr.to_a.first[:id]] end @@ -33,7 +33,7 @@ spotlight_resource_type_ssim: ["iiif_resources"]) index.commit - get :index, search_field: "all_fields" + get :index, params: { search_field: "all_fields" } expect(document_ids.length).to eq 1 expect(assigns[:response][:response][:numFound]).to eq 1 diff --git a/spec/controllers/exhibits_controller_spec.rb b/spec/controllers/exhibits_controller_spec.rb index 1b217ed9..4a0bc76e 100644 --- a/spec/controllers/exhibits_controller_spec.rb +++ b/spec/controllers/exhibits_controller_spec.rb @@ -7,15 +7,13 @@ end describe "#create" do context "when given just a slug" do - let(:params) do + let(:exhibit) do { - exhibit: { - slug: "princeton-best" - } + slug: "princeton-best" } end it "works and pulls the title" do - post :create, params + post :create, params: { exhibit: exhibit } expect(response).not_to render_template "new" last_exhibit = Spotlight::Exhibit.last @@ -25,30 +23,26 @@ end context "when not given a slug" do render_views - let(:params) do + let(:exhibit) do { - exhibit: { - slug: "" - } + slug: "" } end it "renders an error" do - post :create, params + post :create, params: { exhibit: exhibit } expect(response).to render_template "new" expect(assigns["exhibit"].errors.messages[:slug]).to eq ["can't be blank"] end end context "when given no params" do - let(:params) do + let(:exhibit) do { - exhibit: { - tag_list: nil - } + tag_list: nil } end it "renders an error" do - post :create, params + post :create, params: { exhibit: exhibit } expect(response).to render_template "new" expect(assigns["exhibit"].errors.messages[:slug]).to eq ["can't be blank"] diff --git a/spec/controllers/pages_controller_spec.rb b/spec/controllers/pages_controller_spec.rb index ac604aca..a4337d7d 100644 --- a/spec/controllers/pages_controller_spec.rb +++ b/spec/controllers/pages_controller_spec.rb @@ -3,7 +3,7 @@ RSpec.describe PagesController do describe "robots" do it "renders robot.text" do - get :robots, format: :text + get :robots, params: { format: :text } expect(response).to render_template "pages/robots" end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 23eec841..629c8574 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -5,6 +5,8 @@ abort("The Rails environment is running in production mode!") if Rails.env.production? require 'spec_helper' require 'rspec/rails' +require 'rails-controller-testing' + # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in