Feature test about clonning procedures

This commit is contained in:
JC 2016-12-26 10:56:48 +01:00
parent 31653ff553
commit 4c9c898a69
3 changed files with 31 additions and 2 deletions

View file

@ -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')

View 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

View file

@ -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) }