SIM error test

This commit is contained in:
Martin Lensment 2015-03-24 17:17:13 +02:00
parent 53bf7e209d
commit 5d08164f10
2 changed files with 30 additions and 3 deletions

View file

@ -18,7 +18,7 @@
$.post('/registrar/login/mid_status').fail((data) -> $.post('/registrar/login/mid_status').fail((data) ->
clearInterval(status_interval) clearInterval(status_interval)
flash_alert(data.responseJSON.message) flash_alert(data.responseJSON.message)
('.js-login').attr('disabled', false) $('.js-login').attr('disabled', false)
) )
), 1000) ), 1000)

View file

@ -50,10 +50,37 @@ feature 'Sessions', type: :feature do
end end
scenario 'Api user should when there is a sim error', js: true do scenario 'Api user should when there is a sim error', js: true do
client = instance_double("Digidoc::Client", client = instance_double("Digidoc::Client", session_code: '123')
session_code: '123'
allow(client).to receive('session_code=')
allow(client).to receive(:authenticate).and_return(
OpenStruct.new(
user_id_code: '14212128025'
)
) )
allow(client).to receive('authentication_status').and_return(
OpenStruct.new(status: 'SIM_ERROR')
)
allow(Digidoc::Client).to receive(:new) { client }
visit registrar_login_path
page.should have_css('a[href="/registrar/login/mid"]')
page.find('a[href="/registrar/login/mid"]').click
fill_in 'user_phone', with: '00007'
click_button 'Log in'
page.should have_text('Check your phone for confirmation code')
page.should have_text('SIM application error')
end
scenario 'Api user should log in', js: true do
client = instance_double("Digidoc::Client", session_code: '123')
allow(client).to receive('session_code=') allow(client).to receive('session_code=')
allow(client).to receive(:authenticate).and_return( allow(client).to receive(:authenticate).and_return(