开发者

Rails3 - RSpec - How to set request.env?

开发者 https://www.devze.com 2023-04-05 06:28 出处:网络
I try to stub my request.env require \'spec_helper\' describe AuthenticationController do render_views include Devise::TestHelpers

I try to stub my request.env

require 'spec_helper'

describe AuthenticationController do
  render_views
  include Devise::TestHelpers

  describe "GET 'create'" do
    @request.env["HTTP_REFERER"] = '/'

results in

`method_missing': undefined method `env' for nil:NilClass (NoMethodError)

How can I put开发者_JS百科 data into my request.env object before calling the method? Also using request.env = does not work.

0

精彩评论

暂无评论...
验证码 换一张
取 消