aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjpl2017-04-24 15:54:38 +0200
committerjpl2017-04-24 15:54:38 +0200
commita15f093ac5cc18db24c44f5480b3552357926360 (patch)
tree884a64276e63a2d618cdc427723cd439a5035197
parenta6b5d381f5160a7636b076d94886545af55c9fc5 (diff)
downloadchouette-core-a15f093ac5cc18db24c44f5480b3552357926360.tar.bz2
Refs #3149: fixing some tests, contains_date method has to be fixed
-rw-r--r--app/views/calendars/_filters.html.slim4
-rw-r--r--app/views/calendars/index.html.slim6
-rw-r--r--app/views/workbenches/show.html.slim2
-rw-r--r--spec/features/calendars_spec.rb20
-rw-r--r--spec/features/workbenches_spec.rb6
5 files changed, 21 insertions, 17 deletions
diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim
index 8abbd28cd..4fc11b5c7 100644
--- a/app/views/calendars/_filters.html.slim
+++ b/app/views/calendars/_filters.html.slim
@@ -3,7 +3,7 @@
.input-group.search_bar
= f.search_field :short_name_cont, class: 'form-control', placeholder: 'Indiquez un nom de calendrier...'
span.input-group-btn
- button.btn.btn-default type='submit'
+ button.btn.btn-default#search_btn type='submit'
span.fa.fa-search
.ffg-row
@@ -17,4 +17,4 @@
.actions
= link_to 'Effacer', calendars_path, class: 'btn btn-link'
- = f.submit 'Filtrer', class: 'btn btn-default'
+ = f.submit 'Filtrer', id: 'filter_btn', class: 'btn btn-default'
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index 864d1e197..f27b68a05 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -13,9 +13,9 @@
.page_content
.container-fluid
- if params[:q].present? or @calendars.any?
- .row
- .col-lg-12
- = render 'filters'
+ .row
+ .col-lg-12
+ = render 'filters'
- if @calendars.any?
.row
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index 3c403f180..77e670923 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -9,7 +9,7 @@
.col-lg-12.text-right
= link_to Import.model_name.human.pluralize.capitalize, workbench_imports_path(@workbench), class: 'btn btn-primary'
- if policy(Referential).create?
- = link_to t('actions.new'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
+ = link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
/ PageContent
.page_content
diff --git a/spec/features/calendars_spec.rb b/spec/features/calendars_spec.rb
index c1701d7c7..d82c71a18 100644
--- a/spec/features/calendars_spec.rb
+++ b/spec/features/calendars_spec.rb
@@ -20,7 +20,7 @@ describe 'Calendars', type: :feature do
context 'filtering' do
it 'supports filtering by short name' do
fill_in 'q[short_name_cont]', with: calendars.first.short_name
- click_button 'search-btn'
+ click_button 'search_btn'
expect(page).to have_content(calendars.first.short_name)
expect(page).not_to have_content(calendars.last.short_name)
end
@@ -28,8 +28,9 @@ describe 'Calendars', type: :feature do
it 'supports filtering by shared' do
shared_calendar = create :calendar, organisation_id: 1, shared: true
visit calendars_path
- select I18n.t('calendars.index.shared'), from: 'q[shared_eq]'
- click_button 'search-btn'
+ # select I18n.t('true'), from: 'q[shared]'
+ find(:css, '#q_shared').set(true)
+ click_button 'filter_btn'
expect(page).to have_content(shared_calendar.short_name)
expect(page).not_to have_content(calendars.first.short_name)
end
@@ -37,12 +38,16 @@ describe 'Calendars', type: :feature do
it 'supports filtering by date' do
july_calendar = create :calendar, dates: [Date.new(2017, 7, 7)], date_ranges: [Date.new(2017, 7, 15)..Date.new(2017, 7, 30)], organisation_id: 1
visit calendars_path
- fill_in 'q_contains_date', with: '2017/07/07'
- click_button 'search-btn'
+ select '7', from: 'q_contains_date_3i'
+ select 'juillet', from: 'q_contains_date_2i'
+ select '2017', from: 'q_contains_date_1i'
+ click_button 'filter_btn'
expect(page).to have_content(july_calendar.short_name)
expect(page).not_to have_content(calendars.first.short_name)
- fill_in 'q_contains_date', with: '2017/07/18'
- click_button 'search-btn'
+ select '18', from: 'q_contains_date_3i'
+ select 'juillet', from: 'q_contains_date_2i'
+ select '2017', from: 'q_contains_date_1i'
+ click_button 'filter_btn'
expect(page).to have_content(july_calendar.short_name)
expect(page).not_to have_content(calendars.first.short_name)
end
@@ -56,4 +61,3 @@ describe 'Calendars', type: :feature do
end
end
end
-
diff --git a/spec/features/workbenches_spec.rb b/spec/features/workbenches_spec.rb
index 0a71a0b6b..717be96fa 100644
--- a/spec/features/workbenches_spec.rb
+++ b/spec/features/workbenches_spec.rb
@@ -27,7 +27,7 @@ describe 'Workbenches', type: :feature do
context 'user has the permission to create referentials' do
it 'shows the link for a new referetnial' do
- expect(page).to have_link(I18n.t('referentials.actions.new'), href: new_referential_path(workbench_id: workbenches.first))
+ expect(page).to have_link(I18n.t('actions.add'), href: new_referential_path(workbench_id: workbenches.first))
end
end
@@ -35,7 +35,7 @@ describe 'Workbenches', type: :feature do
it 'does not show the clone link for referetnial' do
@user.update_attribute(:permissions, [])
visit referential_path(referential)
- expect(page).not_to have_link(I18n.t('referentials.actions.new'), href: new_referential_path(workbench_id: workbenches.first))
+ expect(page).not_to have_link(I18n.t('actions.add'), href: new_referential_path(workbench_id: workbenches.first))
end
end
end
@@ -44,7 +44,7 @@ describe 'Workbenches', type: :feature do
it "create a new Referential with a specifed line and period" do
visit workbench_path(workbench)
- click_link "Créer un jeu de données"
+ click_link I18n.t('actions.add')
fill_in "referential[name]", with: "Referential to test creation" # Nom du JDD
fill_in "referential[slug]", with: "test" # Code