1
0

omniauth_callbacks_controller_spec.rb 819 B

1234567891011121314151617181920212223242526
  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. request.env["omniauth.auth"] = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/twitter.json')))
  8. end
  9. describe "accepting a callback url" do
  10. it "should update the user's credentials" do
  11. expect {
  12. get :twitter
  13. }.to change { users(:bob).services.count }.by(1)
  14. end
  15. # it "should work with an unknown provider (for now)" do
  16. # request.env["omniauth.auth"]['provider'] = 'unknown'
  17. # expect {
  18. # get :unknown
  19. # }.to change { users(:bob).services.count }.by(1)
  20. # expect(users(:bob).services.first.provider).to eq('unknown')
  21. # end
  22. end
  23. end