Omniauth spec: Improve style

pull/1121/head
Michael Frister 11 years ago
parent 91d53bd1e8
commit 5a153029f5
  1. 34
      spec/features/omniauth/omniauth_spec.rb

@ -2,14 +2,6 @@ require 'spec_helper'
describe 'Omniauth authentication' do describe 'Omniauth authentication' do
after do
User.delete_all
User.current = nil
OmniAuth.config.test_mode = @omniauth_test_mode
Capybara.ignore_hidden_elements = @capybara_ignore_elements
OmniAuth.config.logger = @omniauth_logger
end
before do before do
@omniauth_test_mode = OmniAuth.config.test_mode @omniauth_test_mode = OmniAuth.config.test_mode
@capybara_ignore_elements = Capybara.ignore_hidden_elements @capybara_ignore_elements = Capybara.ignore_hidden_elements
@ -18,6 +10,14 @@ describe 'Omniauth authentication' do
Capybara.ignore_hidden_elements = false Capybara.ignore_hidden_elements = false
end end
after do
User.delete_all
User.current = nil
OmniAuth.config.test_mode = @omniauth_test_mode
Capybara.ignore_hidden_elements = @capybara_ignore_elements
OmniAuth.config.logger = @omniauth_logger
end
context 'sign in existing user' do context 'sign in existing user' do
let(:user) do let(:user) do
FactoryGirl.create(:user, FactoryGirl.create(:user,
@ -53,19 +53,17 @@ describe 'Omniauth authentication' do
context 'register on the fly' do context 'register on the fly' do
let(:user) do let(:user) do
User.new( User.new(force_password_change: false,
{ force_password_change: false, identity_url: 'developer:omnibob@example.com',
identity_url: 'developer:omnibob@example.com', login: 'omnibob',
login: 'omnibob', mail: 'omnibob@example.com',
mail: 'omnibob@example.com', firstname: 'omni',
firstname: 'omni', lastname: 'bob')
lastname: 'bob'
})
end end
before do before do
Setting.stub(:self_registration?).and_return(true) allow(Setting).to receive(:self_registration?).and_return(true)
Setting.stub(:self_registration).and_return("3") allow(Setting).to receive(:self_registration).and_return('3')
end end
it 'should register new user' do it 'should register new user' do

Loading…
Cancel
Save