ruby on rails - Rspec Error: undefined local variable or method `cookies' for #<RSpec::ExampleGroups...etc -


I, like everyone else, have an app that behaves differently, depending on it Is that the user is logged in or not? I am having trouble entering a user through my sessions because as 'props' has no definition of cookie variables. Here is my session with the relevant code: the halper module:

  Turn on user cookies with the help of module sessions Permanent [: remember_token] = user.remember_token self.current_user = user end end  

and here is the code inside my sample:

  is required The 'rails_helper' sessions include "topic # construction facilities" (user :) before the "FactoryGirl.create (: user)}" When the user logs in to the topics related to 'Peth and End Practical' visits, At the end of some tests coming to the current_path end // here before sign_in user  

I get the following error:

What is going on undefined local variables or the 'cookies' method for #?

The cookies hash is available only in RSPC's controller tests. You can tell your specs that they are controlling spectacles By typing type: Requests for your reference, such as:

  Describe that 'cookies are required', type :: request it {hope (cookies [: reminder_token]). To_nil} // Now the variable is defined as zero. End  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -