[#1946] Extract test helper method
This commit is contained in:
parent
74366c6268
commit
5325830d62
3 changed files with 16 additions and 9 deletions
|
@ -1,6 +1,9 @@
|
|||
require 'spec_helper'
|
||||
require 'features/admin/procedure_spec_helper'
|
||||
|
||||
feature 'As an administrateur I wanna clone a procedure', js: true do
|
||||
include ProcedureSpecHelper
|
||||
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
before do
|
||||
|
@ -12,9 +15,7 @@ feature 'As an administrateur I wanna clone a procedure', js: true do
|
|||
before 'Create procedure' do
|
||||
page.find_by_id('new-procedure').click
|
||||
page.find_by_id('from-scratch').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||
fill_in 'procedure_cadre_juridique', with: 'cadre juridique'
|
||||
fill_in_dummy_procedure_details
|
||||
page.find_by_id('save-procedure').click
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
require 'spec_helper'
|
||||
require 'features/admin/procedure_spec_helper'
|
||||
|
||||
feature 'As an administrateur I wanna create a new procedure', js: true do
|
||||
include ProcedureSpecHelper
|
||||
|
||||
let(:administrateur) { create(:administrateur) }
|
||||
|
||||
before do
|
||||
|
@ -37,9 +40,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
page.find_by_id('from-scratch').click
|
||||
page.find_by_id('save-procedure').click
|
||||
page.find_by_id('flash_message').visible?
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||
fill_in 'procedure_cadre_juridique', with: 'cadre juridique'
|
||||
fill_in_dummy_procedure_details
|
||||
page.find_by_id('save-procedure').click
|
||||
expect(page).to have_current_path(admin_procedure_types_de_champ_path(Procedure.first.id.to_s))
|
||||
end
|
||||
|
@ -49,9 +50,7 @@ feature 'As an administrateur I wanna create a new procedure', js: true do
|
|||
before 'Create procedure' do
|
||||
page.find_by_id('new-procedure').click
|
||||
page.find_by_id('from-scratch').click
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||
fill_in 'procedure_cadre_juridique', with: 'cadre juridique'
|
||||
fill_in_dummy_procedure_details
|
||||
page.find_by_id('save-procedure').click
|
||||
|
||||
procedure = Procedure.last
|
||||
|
|
7
spec/features/admin/procedure_spec_helper.rb
Normal file
7
spec/features/admin/procedure_spec_helper.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
module ProcedureSpecHelper
|
||||
def fill_in_dummy_procedure_details
|
||||
fill_in 'procedure_libelle', with: 'libelle de la procedure'
|
||||
page.execute_script("$('#procedure_description').val('description de la procedure')")
|
||||
fill_in 'procedure_cadre_juridique', with: 'cadre juridique'
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue