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
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
@omniauth_test_mode = OmniAuth.config.test_mode
@capybara_ignore_elements = Capybara.ignore_hidden_elements
@ -18,6 +10,14 @@ describe 'Omniauth authentication' do
Capybara.ignore_hidden_elements = false
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
let(:user) do
FactoryGirl.create(:user,
@ -53,19 +53,17 @@ describe 'Omniauth authentication' do
context 'register on the fly' do
let(:user) do
User.new(
{ force_password_change: false,
identity_url: 'developer:omnibob@example.com',
login: 'omnibob',
mail: 'omnibob@example.com',
firstname: 'omni',
lastname: 'bob'
})
User.new(force_password_change: false,
identity_url: 'developer:omnibob@example.com',
login: 'omnibob',
mail: 'omnibob@example.com',
firstname: 'omni',
lastname: 'bob')
end
before do
Setting.stub(:self_registration?).and_return(true)
Setting.stub(:self_registration).and_return("3")
allow(Setting).to receive(:self_registration?).and_return(true)
allow(Setting).to receive(:self_registration).and_return('3')
end
it 'should register new user' do

Loading…
Cancel
Save