|
|
@ -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 |
|
|
|