Nathan de Vries wrote: >> class SomeControllerTest < ActionController::IntegrationTest >> def test_response_has_correct_json_content_type >> get '/some/action.json' >> assert 'application/x-json', response.content_type >> end >> def test_response_conforms_to_google_vis_wire_protocol >> get '/some/action.json' >> # run some checks on response.body, perhaps >> # using JsonPath (XPath for JSON) >> end >> end >> > > If your SomeController#action does some smart stuff you don't really > need to test, you'll need to look into stubbing the methods your > action is calling by using a mocking/stubbing framework. Once you've > got your tests working, then you can start to look into other test > frameworks that provide a little bit of extra syntax-sugar/convenience. > Check out this book - it has some intro info on setting up mocks/stubs using (for example) Mocha (http://agilewebdevelopment.com/plugins/mocha):
Ruby in Practice by Jeremy McAnally and Assaf Arkin (Paperback - Mar 28, 2009) -- Sonia Hamilton. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby or Rails Oceania" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rails-oceania?hl=en -~----------~----~----~----~------~----~------~--~---
