aboutsummaryrefslogtreecommitdiffstats
path: root/spec/features/lines_spec.rb
diff options
context:
space:
mode:
authorRobert2017-07-03 15:34:11 +0200
committerRobert2017-07-04 21:54:04 +0200
commitc48ad4fde3056ef04645b73f7eab54ff867d370c (patch)
tree57af273b48f1ece1b5e16244d6957f407a5d9563 /spec/features/lines_spec.rb
parent747d333ffbcc8ee0c9f1daf93ccca32799434e04 (diff)
downloadchouette-core-c48ad4fde3056ef04645b73f7eab54ff867d370c.tar.bz2
Refs: #3478@1h
newapplication helper default authorization, (no if) -> * DefaultPolicy (all true) * Add some policies (LinePolicy) * Use `boiv:read` pour show, index * Adapted `table_builder`
Diffstat (limited to 'spec/features/lines_spec.rb')
-rw-r--r--spec/features/lines_spec.rb144
1 files changed, 73 insertions, 71 deletions
diff --git a/spec/features/lines_spec.rb b/spec/features/lines_spec.rb
index a55f30ebc..2a442bd2f 100644
--- a/spec/features/lines_spec.rb
+++ b/spec/features/lines_spec.rb
@@ -8,89 +8,91 @@ describe "Lines", type: :feature do
let!(:group_of_line) { create(:group_of_line) }
subject { lines.first }
- describe "index" do
- before(:each) { visit line_referential_lines_path(line_referential) }
+ with_permissions "boiv:read" do
+ describe "index" do
+ before(:each) { visit line_referential_lines_path(line_referential) }
- it "displays lines" do
- expect(page).to have_content(lines.first.name)
- expect(page).to have_content(lines.last.name)
- end
-
- it 'allows only R in CRUD' do
- expect(page).to have_link(I18n.t('actions.show'))
- expect(page).not_to have_link(I18n.t('actions.edit'), href: edit_referential_line_path(referential, lines.first))
- expect(page).not_to have_link(I18n.t('actions.destroy'), href: referential_line_path(referential, lines.first))
- expect(page).not_to have_link(I18n.t('actions.add'), href: new_referential_line_path(referential))
- end
-
- context 'filtering' do
- it 'supports filtering by name' do
- fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.name
- click_button 'search-btn'
+ it "displays lines" do
expect(page).to have_content(lines.first.name)
- expect(page).not_to have_content(lines.last.name)
+ expect(page).to have_content(lines.last.name)
end
- it 'supports filtering by number' do
- fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.number
- click_button 'search-btn'
- expect(page).to have_content(lines.first.name)
- expect(page).not_to have_content(lines.last.name)
+ it 'allows only R in CRUD' do
+ expect(page).to have_link(I18n.t('actions.show'))
+ expect(page).not_to have_link(I18n.t('actions.edit'), href: edit_referential_line_path(referential, lines.first))
+ expect(page).not_to have_link(I18n.t('actions.destroy'), href: referential_line_path(referential, lines.first))
+ expect(page).not_to have_link(I18n.t('actions.add'), href: new_referential_line_path(referential))
end
- it 'supports filtering by objectid' do
- fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.objectid
- click_button 'search-btn'
- expect(page).to have_content(lines.first.name)
- expect(page).not_to have_content(lines.last.name)
+ context 'filtering' do
+ it 'supports filtering by name' do
+ fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.name
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).not_to have_content(lines.last.name)
+ end
+
+ it 'supports filtering by number' do
+ fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.number
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).not_to have_content(lines.last.name)
+ end
+
+ it 'supports filtering by objectid' do
+ fill_in 'q[name_or_number_or_objectid_cont]', with: lines.first.objectid
+ click_button 'search-btn'
+ expect(page).to have_content(lines.first.name)
+ expect(page).not_to have_content(lines.last.name)
+ end
end
end
- end
- describe "show" do
- it "displays line" do
- visit line_referential_line_path(line_referential, lines.first)
- expect(page).to have_content(lines.first.name)
+ describe "show" do
+ it "displays line" do
+ visit line_referential_line_path(line_referential, lines.first)
+ expect(page).to have_content(lines.first.name)
+ end
end
- end
- # Fixme #1780
- # describe "new" do
- # it "creates line and return to show" do
- # visit line_referential_lines_path(line_referential)
- # click_link "Ajouter une ligne"
- # fill_in "line_name", :with => "Line 1"
- # fill_in "Numéro d'enregistrement", :with => "1"
- # fill_in "Identifiant Neptune", :with => "chouette:test:Line:999"
- # click_button("Créer ligne")
- # expect(page).to have_content("Line 1")
- # end
- # end
+ # Fixme #1780
+ # describe "new" do
+ # it "creates line and return to show" do
+ # visit line_referential_lines_path(line_referential)
+ # click_link "Ajouter une ligne"
+ # fill_in "line_name", :with => "Line 1"
+ # fill_in "Numéro d'enregistrement", :with => "1"
+ # fill_in "Identifiant Neptune", :with => "chouette:test:Line:999"
+ # click_button("Créer ligne")
+ # expect(page).to have_content("Line 1")
+ # end
+ # end
- # Fixme #1780
- # describe "new with group of line", :js => true do
- # it "creates line and return to show" do
- # visit new_line_referential_line_path(line_referential)
- # fill_in "line_name", :with => "Line 1"
- # fill_in "Numéro d'enregistrement", :with => "1"
- # fill_in "Identifiant Neptune", :with => "test:Line:999"
- # fill_in_token_input('line_group_of_line_tokens', :with => "#{group_of_line.name}")
- # find_button("Créer ligne").trigger("click")
- # expect(page).to have_text("Line 1")
- # expect(page).to have_text("#{group_of_line.name}")
- # end
- # end
+ # Fixme #1780
+ # describe "new with group of line", :js => true do
+ # it "creates line and return to show" do
+ # visit new_line_referential_line_path(line_referential)
+ # fill_in "line_name", :with => "Line 1"
+ # fill_in "Numéro d'enregistrement", :with => "1"
+ # fill_in "Identifiant Neptune", :with => "test:Line:999"
+ # fill_in_token_input('line_group_of_line_tokens', :with => "#{group_of_line.name}")
+ # find_button("Créer ligne").trigger("click")
+ # expect(page).to have_text("Line 1")
+ # expect(page).to have_text("#{group_of_line.name}")
+ # end
+ # end
- # Fixme #1780
- # describe "edit and return to show" do
- # it "edit line" do
- # visit line_referential_line_path(line_referential, subject)
- # click_link "Editer cette ligne"
- # fill_in "line_name", :with => "Line Modified"
- # fill_in "Numéro d'enregistrement", :with => "test-1"
- # click_button("Editer ligne")
- # expect(page).to have_content("Line Modified")
- # end
- # end
+ # Fixme #1780
+ # describe "edit and return to show" do
+ # it "edit line" do
+ # visit line_referential_line_path(line_referential, subject)
+ # click_link "Editer cette ligne"
+ # fill_in "line_name", :with => "Line Modified"
+ # fill_in "Numéro d'enregistrement", :with => "test-1"
+ # click_button("Editer ligne")
+ # expect(page).to have_content("Line Modified")
+ # end
+ # end
+ end
end