demarches-normaliennes/spec/system/admin/procedure_locked_spec.rb
Pierre de La Morinerie 9fd38cae5e specs: migrate from features to system specs
System specs have been available since Rails 5.1, and are better
integrated with the Rails framework.

- Rename `spec/features` to `spec/system`
- Rename `feature do` to `describe do`
- Configure Capybara for system specs

Steps mostly taken from https://medium.com/table-xi/a-quick-guide-to-rails-system-tests-in-rspec-b6e9e8a8b5f6
2021-10-26 12:24:46 +02:00

26 lines
928 B
Ruby

describe 'procedure locked' do
let(:administrateur) { create(:administrateur) }
before do
login_as administrateur.user, scope: :user
visit admin_procedure_publication_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).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