[rspec-users] Testing Controllers in Rspec
lists at ruby-forum.com
Wed Feb 27 18:53:09 UTC 2013
guirec c. wrote in post #1099350:
> I think your are confused with acceptance specs and controllers spec. In
> a controller spec you must to test only your controller in total
> isolation. You can use stubs and mocks to do it. In the acceptance spec
> you must to test all the behaviour at a very high level.
> I think to create a record in the database for a feature spec is
> correct. You can see an example of my specs here :
> and here :
> As you can see, I use acceptance DSL
> and factory girl (https://github.com/thoughtbot/factory_girl_rails).
> I hope to help you. It's very hard to begin.
>From the link above you provided for acceptance testing I understand
that we write test cases for failing conditions first and then write the
code until the tests are passed. But one question that arise in my mind
is that in acceptance testing do we need to write tests for checking
blank values, no or no of chars for password field (like validations)??
For eg, if I am writing test cases for Forgot password feature, then I
write test cases as above what I have written. So as per the test cases
I would write code in controllers/models/views and make the test pass.
But do I also need to write test cases for scenarios like if Email field
is left blank and clicked submit button, then it should fail??
Posted via http://www.ruby-forum.com/.
More information about the rspec-users