Search code examples
ruby-on-rails-3cucumberrspec2

When to use Cucumber and when to use RSpec?


I am new to Cucumber testing and I am trying to understand when to use Cucumber and when to use RSpec. For my models, I know I should be testing them with RSpec, and I know that I don't need to write RSpec request specs if I write Cucumber stories instead. The thing I don't know when to use what is with views and controllers. Should I be using RSpec to test my views and controllers, or can I just skip them because I am using Cucumber for my higher level testing? Any advice would be greatly appreciated! Thanks!


Solution

  • I use RSpec to drive the development and testing of my models and to some extent my controllers, and Cucumber to drive the development and testing of my views (and subsequently their integration with the controllers).

    I don't feel writing Cucumber tests allows me to "skip" writing RSpec tests because a lot of development takes place in the model layer before any views are created.