Ruby On Rails Classroom image

prateek  darmwal / Professional / Web Technology

 
To post your Question Join Classroom
 
Lesson Topics's No:-  First|1 | 2 | 3|Last
Lessons:- Rendering with a Flash Message

This flash persistence is a bug in our application, and before proceeding with a fix, it is a good idea to write a test catching the error. In particular, the signin failure tests are currently passing:

 

$ bundle exec rspec spec/requests/authentication pages spec.rb \
> -e  "signin with invalid information"

 

But the tests should never pass when there is a known bug, so we should add a failing test to catch it. Fortunately, dealing with a problem like flash persistence is one of many areas where integration tests really shine; they let us say exactly what we mean: 

 

describe   "after visiting another page"    do
      before { click link  "Home"  }
       it { should not have selector (  'div.alert.alert-error' )  }
end

 

                        Figure 8.7 An example of the flash persisting.

 

After submitting invalid signin data, this test follows the Home link in the site layout and then requires that the flash error message not appear. The updated code, with the modified flash test, is shown in Listing 8.11.

 

 

The new test fails, as required:

bundle exec rspec spec/requests/authentication pages spec.rb  \
> -e   "signin with invalid information"

 

 
 
 
image
prateek  darmwal

Skills    Ruby On Rails

Qualifications :- High School - S.K.M. Sn. Sec. School, Haldwani, College/University - Graphic Era Hill University, Bhimtal,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:- I like to explore new technologies. I have skills in ruby on rails, php5, cakephp, jquery, javascript, html/css, java, c & c++. I love coding
Explore
 

  Students (0)