omniauth_callbacks_controller_spec.rb 522 B

123456789101112131415161718
  1. require 'rails_helper'
  2. describe OmniauthCallbacksController do
  3. before do
  4. sign_in users(:bob)
  5. OmniAuth.config.test_mode = true
  6. request.env["devise.mapping"] = Devise.mappings[:user]
  7. end
  8. describe "accepting a callback url" do
  9. it "should update the user's credentials" do
  10. request.env["omniauth.auth"] = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/twitter.json')))
  11. expect {
  12. get :twitter
  13. }.to change { users(:bob).services.count }.by(1)
  14. end
  15. end
  16. end