Ruby On Rails Classroom image

Anil  Bist / 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
Anil  Bist

Skills    Ruby On Rails

Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,
Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-

I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore

 

  Students (0)