Ruby On Rails Classroom image

Pooja  Negi / Student / 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' )
end 
 
 
 
image
Pooja   Negi

Skills    Ruby On Rails

Qualifications :- High School - SSN high school, College/University - HNBGU, College/University - SRHU,
Location :-Ranipokhari,Rishikesh,Uttarakhand,India
Description:- Student
Explore
 

  Students (0)