2016-12-26 10:56:48 +01:00
|
|
|
require 'spec_helper'
|
2018-05-23 23:32:49 +02:00
|
|
|
require 'features/admin/procedure_spec_helper'
|
2016-12-26 10:56:48 +01:00
|
|
|
|
|
|
|
feature 'As an administrateur I wanna clone a procedure', js: true do
|
2018-05-23 23:32:49 +02:00
|
|
|
include ProcedureSpecHelper
|
|
|
|
|
2016-12-26 10:56:48 +01:00
|
|
|
let(:administrateur) { create(:administrateur) }
|
|
|
|
|
|
|
|
before do
|
2019-08-09 10:46:39 +02:00
|
|
|
login_as administrateur.user, scope: :user
|
2018-12-28 18:24:39 +01:00
|
|
|
visit new_from_existing_admin_procedures_path
|
2016-12-26 10:56:48 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
context 'Cloning procedure' do
|
|
|
|
before 'Create procedure' do
|
2018-05-09 16:16:09 +02:00
|
|
|
page.find_by_id('from-scratch').click
|
2018-05-23 23:32:49 +02:00
|
|
|
fill_in_dummy_procedure_details
|
2016-12-26 10:56:48 +01:00
|
|
|
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
|