rspec integration / request specs vs controller specs with an emphasis on JSON api -


i have adopted app has test coverage of tests of mixed quality. majority of app working against json api. going write request specs authenticating , sending post's authentication data wasn't trivial. testing json api, controller specs more appropriate?

for example,

 match 'api/login-mobile' => 'api#login_mobile', :as => :login_mobile, :defaults => {:format => 'json' } 

this seem trivial @ require integration spec capybara. in addition, capybara wouldn't send session data natively , require

page.driver.post ..... 

i integration tests testing ui interactions seems bad model testing json api. missing something? or there tutorial doing integration / requeset tests? looking @ discourse right , pretty tests controllers .... if integration / request specs bees knees, why make decision?

thx in advance

i integration-style tests, this post.

interacting api endpoint via json higher-level controller, use feature , scenario block descriptors provided rspec. (example here).

functionally, it's not different controller spec, helps push toward scenario/feature-type of testing, not unit-level testing.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -