3. Helper Methods
● Let – lazy evaluated, ie not evaluated until the
first call. The value is cached in a 'it' block
● Let! Force invocated before each 'it' block
4. Model Specs
● Spec for each class & instance method
● Call the method & match the response with
the expected value
● Use Factory data to create objects to test
against
5. Controller Specs
● Simulate a http request
● Views are stubbed by default. If you are using
jbuilder or similar template on the api, use
'render_views' to render the views
● Also pass in the format parameter, in the
request
● Check for response code, response data etc
6. Expecations
● Every object in Rspec has 2 methods should,
should_not
● They accept a matcher as an argument
( matcher can act in a positive or negative
mode)
● https://www.relishapp.com/rspec/rspec-
expectations/v/2-13/docs/built-in-matchers
7. Mocks(Mocha)
● Mocha is the preferred framework for mocking
● Expects, with, returns
● mock_obj = Mock(obj)
● Stubs & returns on mock objects
8. Command Line Options
● --fail-fast to exit after the first failue
● :789 - runs the spec in that line