sunny1304
sunny1304

Reputation: 1694

Approach towards writing test case with RSpec

I am learning Rspec and many questions are rising in my mind.

Is it really necessary to write rspec test for views or controller ?? And how writing Rspec helps you in your daliy work ?? I am not a very experienced developer so right now I am failing to understand how Rspec can help me. I know testing is important, thats why I am asking you... "What should be my approach towards Rspec ?" Please help me understand the big picture of rspec.

Upvotes: 0

Views: 115

Answers (1)

Ju Liu
Ju Liu

Reputation: 3999

  • Testing views is good because you know that your application is working full stack.
  • Testing controllers is good because view testing is slow :)
  • Writing tests helps you thinking about the problem first (writing the test) before writing the code that makes the test pass (that's writing the solution). So you realize you have been doing this wrong your whole life!
  • The Big Picture of TDD is to give you confidence while writing code! You can refactor, move, edit and delete your code without fear.

Upvotes: 2

Related Questions