spec/requests/omniauth_spec.rb in iugusdk-1.0.0.alpha.1 vs spec/requests/omniauth_spec.rb in iugusdk-1.0.0.alpha.2

- old
+ new

@@ -1,23 +1,57 @@ require 'spec_helper' describe 'omniauth requests' do + before(:each) do + IuguSDK::enable_social_login = true + IuguSDK::enable_social_linking = true + end context "provider not found" do before(:each) do visit '/account/auth/orkut' end it { page.should have_content "Not found" } end + context "when not signed in" do + context "and enable_social_login == false" do + before(:each) do + IuguSDK::enable_social_login = false + end + + it 'should raise RoutingError' do + lambda { + visit '/account/auth/facebook' + }.should raise_error ActionController::RoutingError + end + end + end + + context "when signed in" do + context "and enable_social_linking == false" do + before(:each) do + IuguSDK::enable_social_linking = false + visit '/account/auth/facebook' + end + + it 'should raise RoutingError' do + lambda { + visit '/account/auth/facebook' + }.should raise_error ActionController::RoutingError + end + end + 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