Testing OAuth Apis in rails 3.x apps
- Install phantomjs
- Add rspec, poltergeist, capybara, vcr to Gemfile
- bundle install
- Create spec/acceptance folder
- Create spec/acceptance/acceptance_helper.rb (see below)
- Create spec for oauth flow (see below) read the comments carefully
- visit http://localhost/users/sign_up
- user fills in details
- user gets redirected to oauth provider
- on oauth provider site, user logs in, and approves app
- user is redirected back to http://localhost/oauth/callback?code=<a_code>
- Oauth code (<auth_code>) is upgraded to access_token and refresh_token, and persisted
- user is redirected to app, now authenticated
Suggestions more than welcome!
It looks like 6-spec-acceptance-user_registration.rb is missing a closing single quote on line 25.