Feature test about clonning procedures
This commit is contained in:
parent
31653ff553
commit
4c9c898a69
3 changed files with 31 additions and 2 deletions
|
@ -19,7 +19,7 @@
|
|||
%td
|
||||
= procedure.created_at_fr
|
||||
%td
|
||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary')
|
||||
= link_to('Cloner', admin_procedure_clone_path(procedure.id), 'data-method' => :put, class: 'btn-sm btn-primary clone-btn')
|
||||
- unless procedure.published? || procedure.archived?
|
||||
= link_to('X', url_for(controller: 'admin/procedures', action: :destroy, id: procedure.id), 'data-method' => :delete, class: 'btn-sm btn-danger')
|
||||
|
||||
|
|
29
spec/features/admin/procedure_cloning_spec.rb
Normal file
29
spec/features/admin/procedure_cloning_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'As an administrateur I wanna clone a procedure', js: true do
|
||||
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
before do
|
||||
login_as administrateur, scope: :administrateur
|
||||
visit root_path
|
||||
end
|
||||
|
||||
context 'Cloning procedure' do
|
||||
|
||||
before 'Create procedure' do
|
||||
page.find_by_id('new-procedure').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').data('wysihtml5').editor.setValue('description de la procedure')")
|
||||
page.find_by_id('save-procedure').click
|
||||
end
|
||||
|
||||
scenario 'Cloning' do
|
||||
visit admin_procedures_draft_path
|
||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('1')
|
||||
page.all('.clone-btn').first.click
|
||||
visit admin_procedures_draft_path
|
||||
expect(page.find_by_id('procedures')['data-item-count']).to eq('2')
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,6 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'as an administrateur I wanna create a new procedure', js: true do
|
||||
feature 'As an administrateur I wanna create a new procedure', js: true do
|
||||
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue