Sha256: 03894d48da839baf8c165c8612629624dc4fb2f75a9280d7c8bea30b73e2128c

Contents?: true

Size: 1.89 KB

Versions: 2

Compression:

Stored size: 1.89 KB

Contents

require 'spec_helper'

describe 'omniauth requests' do
  context "provider not found" do
    before(:each) do
      visit '/account/auth/orkut'
    end

    it { page.should have_content "Not found" }
  
  end

  context "facebook" do
    context 'not signed in' do
      before(:each) do
        visit '/account/auth/facebook'
      end

      it { page.should have_content "signed in" }
    end
    
    context "already signed in" do
      before(:each) do
        visit new_user_session_path 
        Fabricate(:user, :email => 'test@test.test', :password => 'testing', :password_confirmation => 'testing')
        fill_in 'user_email', :with => "test@test.test"
        fill_in 'user_password', :with => "testing"
        click_on 'Sign in'
        visit '/account/auth/facebook'
        visit '/settings/profile'
      end

      it { page.should have_content "UID" }
    
    end

    context "with email already used" do
      before(:each) do
        email = OmniAuth.config.mock_auth[:facebook]["extra"]["raw_info"]["email"]
        Fabricate(:user, :email => email)
        visit '/account/auth/facebook'
      end
    
      it { page.should have_content I18n.t('errors.messages.email_already_in_use') }
    
    end
  
  end

  context "twitter" do

    context "not signed in" do

      before(:each) do
        visit '/account/auth/twitter'
      end
  
      it { page.should have_content "signed in" }
      
    end
  
    context "already signed in" do

      before(:each) do
        visit new_user_session_path 
        Fabricate(:user, :email => 'test@test.test', :password => 'testing', :password_confirmation => 'testing')
        fill_in 'user_email', :with => "test@test.test"
        fill_in 'user_password', :with => "testing"
        click_on 'Sign in'
        visit '/account/auth/twitter'
        visit '/settings/profile'
      end

      it { page.should have_content "UID" }
    
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
iugusdk-1.0.0.alpha.1 spec/requests/omniauth_spec.rb
iugusdk-1.0.0.alpha.0 spec/requests/omniauth_spec.rb