diff --git a/db/migrate/20190724055909_move_to_managed_authenticator.rb b/db/migrate/20190724055909_move_to_managed_authenticator.rb index 5ee2735..6356bc1 100644 --- a/db/migrate/20190724055909_move_to_managed_authenticator.rb +++ b/db/migrate/20190724055909_move_to_managed_authenticator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class MoveToManagedAuthenticator < ActiveRecord::Migration[5.2] def up execute <<~SQL diff --git a/spec/plugin_spec.rb b/spec/plugin_spec.rb index 03faa79..c378817 100644 --- a/spec/plugin_spec.rb +++ b/spec/plugin_spec.rb @@ -33,11 +33,11 @@ describe OAuth2BasicAuthenticator do let(:authenticator) { OAuth2BasicAuthenticator.new } let(:auth) do - OmniAuth::AuthHash.new({ 'provider' => 'oauth2_basic', - 'credentials' => { 'token': 'token' }, - 'uid' => '123456789', - 'info' => { id: 'id' }, - 'extra' => {} }) + OmniAuth::AuthHash.new('provider' => 'oauth2_basic', + 'credentials' => { 'token': 'token' }, + 'uid' => '123456789', + 'info' => { id: 'id' }, + 'extra' => {}) end before(:each) do @@ -79,14 +79,14 @@ describe OAuth2BasicAuthenticator do result = authenticator.after_authenticate(auth) expect(result.email_valid).to eq(true) end - + it 'doesnt validate user email if provider hasnt verified' do SiteSetting.oauth2_email_verified = false authenticator.stubs(:fetch_user_details).returns(email: user.email, email_verified: nil) result = authenticator.after_authenticate(auth) expect(result.email_valid).to eq(false) end - + it 'doesnt affect the site setting' do SiteSetting.oauth2_email_verified = true authenticator.stubs(:fetch_user_details).returns(email: user.email, email_verified: false) @@ -235,7 +235,7 @@ describe OAuth2BasicAuthenticator do let(:authenticator) { OAuth2BasicAuthenticator.new } let(:auth) do - OmniAuth::AuthHash.new({ + OmniAuth::AuthHash.new( 'provider' => 'oauth2_basic', 'credentials' => { 'token' => 'token' @@ -246,7 +246,7 @@ describe OAuth2BasicAuthenticator do "email" => 'sammy@digitalocean.com' }, 'extra' => {} - }) + ) end let(:access_token) do