Fixed admin login spects

This commit is contained in:
Priit Tark 2015-05-20 17:58:07 +03:00
parent 9a20c73a40
commit 77d6ab93ce
13 changed files with 30 additions and 15 deletions

View file

@ -953,7 +953,7 @@ ActiveRecord::Schema.define(version: 20150519144118) do
t.text "crt"
t.string "type"
t.string "registrant_ident"
t.string "encrypted_password", default: ""
t.string "encrypted_password", default: "", null: false
t.datetime "remember_created_at"
t.integer "failed_attempts", default: 0, null: false
t.datetime "locked_at"

View file

@ -3,6 +3,7 @@
Fabricator(:admin_user) do
username 'gitlab'
password 'ghyt9e4fu'
password_confirmation 'ghyt9e4fu'
email 'info@gitlab.eu'
country_code 'FI'
roles ['admin']
@ -11,6 +12,9 @@ end
Fabricator(:ee_user, from: :admin_user) do
identity_code "45002036517"
country_code 'EE'
username 'user1'
password 'testtest'
password_confirmation 'testtest'
roles ['admin']
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Admin users', type: :feature do
before :all do
@admin_user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@admin_user = Fabricate(:admin_user)
end
context 'as unknown user' do

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Api users', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
@api_user = Fabricate(:api_user)
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Admin contact', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
@contact = Fabricate(:contact, name: 'Mr John')
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'EPP log', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
@contact = Fabricate(:contact, name: 'Mr John')
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Invoice', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
Fabricate(:invoice)
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Repp log', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
end
context 'as unknown user' do

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Api users', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
@registrar = Fabricate(:registrar)
end

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Zonefile settings', type: :feature do
before :all do
@user = Fabricate(:admin_user, username: 'user1', identity_code: '37810013087')
@user = Fabricate(:admin_user)
end
context 'as unknown user' do

View file

@ -2,7 +2,7 @@ require 'rails_helper'
feature 'Sessions', type: :feature do
before :all do
Fabricate(:ee_user)
@user = Fabricate(:ee_user)
@registrar1 = Fabricate(:registrar1)
@registrar2 = Fabricate(:registrar2)
Fabricate.times(2, :domain, registrar: @registrar1)
@ -11,9 +11,8 @@ feature 'Sessions', type: :feature do
scenario 'Admin logs in' do
visit root_path
page.should have_button('ID card (user1)')
click_on 'ID card (user1)'
sign_in @user
page.should have_text('Welcome!')
uri = URI.parse(current_url)

View file

@ -12,9 +12,11 @@ describe AdminUser do
@user.errors.full_messages.should match_array([
"Country code is missing",
"Email Email is missing",
"Email Email is missing",
"Password Password is missing",
"Username Username is missing",
"Roles is missing"
"Password Password is missing",
"Roles is missing",
"Username Username is missing"
])
end

View file

@ -1,7 +1,17 @@
module Feature
def sign_in(user)
visit '/admin/logout'
click_on 'ID card (user1)' if user.username == 'user1'
if user.username == 'user1'
fill_in 'admin_user_username', with: 'user1'
fill_in 'admin_user_password', with: 'testtest'
end
if user.username == 'gitlab'
fill_in 'admin_user_username', with: 'gitlab'
fill_in 'admin_user_password', with: 'ghyt9e4fu'
end
click_on 'Log in'
end
end