Fix procedure_locked_spec
`login_as administrateur, scope: :administrateur` doesn’t seem to actually do anything, but testing for the _absence_ of content can’t break. - Make the test fail if login fails, - Fix the login, - Write the opposite test, - Update the searched content to the actual text used in the partial
This commit is contained in:
parent
0090957ed1
commit
fc416ee2ec
1 changed files with 14 additions and 4 deletions
|
@ -2,17 +2,27 @@ require 'spec_helper'
|
|||
|
||||
feature 'procedure locked' do
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
let (:published_at) { nil }
|
||||
let(:procedure) { create(:procedure, administrateur: administrateur, published_at: published_at) }
|
||||
|
||||
before do
|
||||
login_as administrateur, scope: :administrateur
|
||||
login_as administrateur.user, scope: :user
|
||||
visit admin_procedure_path(procedure)
|
||||
end
|
||||
|
||||
context 'when procedure is not published' do
|
||||
let(:procedure) { create(:procedure, administrateur: administrateur) }
|
||||
|
||||
scenario 'info label is not present' do
|
||||
expect(page).not_to have_content('Cette démarche a été publiée, certains éléments ne peuvent plus être modifiés')
|
||||
expect(page).to have_content('Test et publication')
|
||||
expect(page).not_to have_content('Cette démarche est publiée, certains éléments ne peuvent plus être modifiés.')
|
||||
end
|
||||
end
|
||||
|
||||
context 'when procedure is published' do
|
||||
let(:procedure) { create(:procedure, :published, administrateur: administrateur) }
|
||||
|
||||
scenario 'info label is present' do
|
||||
expect(page).to have_content('Publication')
|
||||
expect(page).to have_content('Cette démarche est publiée, certains éléments ne peuvent plus être modifiés.')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue