0
をアップグレード5レールの後にコントローラーのテスト中:それは、コントローラの"{}のための方法`クッキー未定義:ハッシュ" 私はシンプルなRSpecのコントローラテストしてい
require 'spec_helper'
describe RenderedTemplatesController, type: :controller do
let(:template) { create(:template) }
describe "#edit" do
it "skips intercom_rails_auto_include" do
get :edit, params: { id: template.id }
expect(controller).to_not receive(:intercom_rails_auto_include)
end
end
end
は以下のようになります。
class RenderedTemplatesController < ApplicationController
load_and_authorize_resource :template, through: :current_account, id_param: :id, except: :preview_by_uuid
skip_authorization_check only: :preview_by_uuid
skip_before_action :authorise, only: :preview_by_uuid
skip_after_action :intercom_rails_auto_include
layout false
def edit
end
# ...
end
それRailsの4.2に偉大な作業が、5をレールにアップグレードした後に、このエラーが表示されました:
RenderedTemplatesController#edit skips intercom_rails_auto_include
Failure/Error: get :edit, params: { id: template.id }
NoMethodError:
undefined method `cookies' for {}:Hash
actionpack-5.0.6/lib/action_controller/test_case.rb:390:in `get'
rails-controller-testing-1.0.2/lib/rails/controller/testing/integration.rb:12:in `block (2 levels) in <module:Integration>'
# ./spec/controllers/rendered_templates_controller_spec.rb:33:in `block (3 levels) in <top (required)>'
activesupport-5.0.6/lib/active_support/dependencies.rb:287:in `load'
activesupport-5.0.6/lib/active_support/dependencies.rb:287:in `block in load'
activesupport-5.0.6/lib/active_support/dependencies.rb:259:in `load_dependency'
activesupport-5.0.6/lib/active_support/dependencies.rb:287:in `load'
spring-commands-rspec-1.0.4/lib/spring/commands/rspec.rb:18:in `call'
spring-2.0.2/lib/spring/command_wrapper.rb:38:in `call'
spring-2.0.2/lib/spring/application.rb:201:in `block in serve'
spring-2.0.2/lib/spring/application.rb:171:in `fork'
spring-2.0.2/lib/spring/application.rb:171:in `serve'
spring-2.0.2/lib/spring/application.rb:141:in `block in run'
spring-2.0.2/lib/spring/application.rb:135:in `loop'
spring-2.0.2/lib/spring/application.rb:135:in `run'
spring-2.0.2/lib/spring/application/boot.rb:19:in `<top (required)>'
# -e:1:in `<main>'
ことがFIXEすることができますどのようにd?