Rails Tutorial: Chapter 8.1.5 error (rendering with a flash message; listings 8.11 and 8.12) -


I'm taking the ROR tutorial, in the last part of Chapter 8.1.5, when all RSPEC tests will be green, then I can not get to do my work. I run bundle ent rspec spec / requests / authentication_pages_spec.rb -e "Sign In with Invalid Information" with this error and one of the four trials fails:

  1) Invalid information Failure / error after the authentication signin arrives at any other page with: it is not required_jalector ('div.alert.alert-error')} expected css "div.alert.alert-error" to not return anything # ./spec/requests/authentication_pages_spec.rb: 25: `Block (level 5) & lt; Top (required) & gt;   

App / Controllers / Session_ Controller The text for RB is below:

  Class session controller & lt; ApplicationController def new end def user = User.find_by_email (params [: session] [: Email]) if user & amp; Amp; User.authenticate (params [: session] [: password]) # User sign in and redirect to user's show page. Else flash.now [: error] = 'Invalid e-mail / password combination' render 'new' end end df end ends   

text for spec / requests / authetication_pages_spec.rb Below is:

  Requires Description of "Authentication" {page} before the "signin page" (sign in_path) (must be 'esetor' ( 'H1', text: 'sign in') {} _selector ('title', text: 'sign in')} Finally describe "signin" {signin_path} before going to "invalid information" {{Link_link "home"}} {} '' ('div' after the "{click_button" sign in "} before" {"Click_link" home}} with " .alert.alert-error ', text:' invalid 'should_not has_selector (' div.alert.alert-error ')} end-end "with valid information" (user :) {FactoryGirl.create (user :) before filling Before filling out "email", use it: user.email fill_in "password", along with: user.password click_button "sign in" must end it ('title', text: user .name)} () Should ('profile', href: user_path (n User})}} {should be _link ('sign out', href: signout_path)} {if_not has_link ('sign in', href: signin_path)} end and end   

if If you have any ideas or ideas, please tell me, I am completely stumped!

I cloned and found your problem.

Do not go anywhere in your header file ( app / view / layout / _header.html. ARB ):

   
  "with invalid information" Describe {{Div.alert.alert-error ', text:' invalid '}}   / Pre> 

... but when you click on a link that is anywhere Also do not go ...

  Describe "after going to another page" {click_link "Home"} # does not go anywhere {do ​​not need} _selector ('div.alert .alert-error ')} and end D   

... this error is still on the page, so the test fails correctly.

When you change your "home" link destination to '#' , then you should change your test.

/ P>

In view of the text, if you are on chapter 8, it seems that you have lost one step to return some chapters, so when you went back And if you decide it then you should be in a better position.

I also recommend setting up the lawns so that you can call your tests on helpful capebara methods like save_and_open_page and when you call The way you open a browser with the status of your page; Helps with debugging a lot.

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -