Ruby On Rails Classroom image

Neha  Jaggi / Professional / Web Technology

To post your Question Join Classroom
Lesson Topics's No:-  |1 | 2 | 3|Last
Lessons:- Counterpoint: RSpec Custom Matchers

  Counterpoint: RSpec Custom Matchers

Having written some simple Cucumber scenarios, it’s worth comparing the result to the equivalent RSpec examples. First, take a look at the Cucumber feature in Listing 8.32 and the corresponding step definitions in Listing 8.33. Then take a look at the RSpec request specs (integration tests):



You can see how a case could be made for either Cucumber or integration tests. Cucumber features are easily readable, but they are entirely separate from the code that implements them—a property that cuts both ways. I find that Cucumber is easy to read and awkward to write, while integration tests are (for a programmer) a little harder to read and much easier to write.

          One nice effect of Cucumber’s separation of concerns is that it operates at a higher level of abstraction. For example, we write

Then  he should see an error message


to express the expectation of seeing an error message, and

Then /ˆhe should see an error message$/  do
        page.should have selector ( 'div.alert.alert-error', text:  'Invalid' )
Neha  Jaggi

Skills    Ruby On Rails

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

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). 


  Students (0)