Ruby On Rails Classroom image

Neha  Jaggi / 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
Neha  Jaggi

Skills    Ruby On Rails

Qualifications :- High School - , College/University - Graphic Era Hill University, Dehradun, College/University - ,
Location :-Dehradun,Dehradun,UTTARAKHAND,India
Description:-

Experienced Software Developer with a demonstrated history of working in the Information Technology and services industry. Skilled in Web Technologies (Ruby on Rails, PostgreSQL, php, Laravel and AJAX). 


Explore
 

  Students (0)