How do I test a Rails application with RSpec to get full testing coverage?

When writing specifications for a simple Rails application, should you use the right approach to fully cover testing?

  • Enter feature specifications for all user stories.
  • Write controller specifications to ensure that the individual responses to actions are correct and that all required variables are set.
  • Write model specifications to provide all methods, validations, e tc. work as expected
  • Write a mailing list specification
  • Enter routing specifications

Is this enough, too much (for example, can I skip some lower level specifications if I wrote function specifications), or not enough? Why?

+4
source share
2 answers

You do not need to write specifications for each object in each layer in order to get 100% testing coverage or test drive (you need to complete) all the important actions in your application. Instead, since Behavioral Development (BDD) advises writing specifications from the outside to inside and writing lower-level specifications only as needed.

: , , , ​​ . ( , ), , , , , , , .

  • ( , , ), ,
  • , , .

  • , .
  • , . , , : , , , (, ), , , , .

(, , , , ..), .

  • , . , , , , , , , , , .

    , , , , , , , , , - .

- :

  • , . , , , .., .
  • , ( ), .
  • , , , . - , , Rails .

, 100%.

+2

. , . . , , . . . . . .

. . . , , . , , API, , , . , , - , .

? . , , . ? ? , , ? , , , . , - , .

, . . . , , , .

0

All Articles