specs: fix Capybara warning

Capybara logs several warnings during tests:

> Locator Integer:243 for selector :link must be an instance of String
> or Symbol. This will raise an error in a future version of Capybara.

This is because we use selectors like `have_link(dossier.id)`, where the
locator is a Number (instead of a String or Symbol).
This commit is contained in:
Pierre de La Morinerie 2019-11-28 12:09:12 +01:00
parent 939a162057
commit e7dd9e36d6
3 changed files with 18 additions and 18 deletions

View file

@ -25,10 +25,10 @@ feature "procedure filters" do
scenario "should list all dossiers" do
within ".dossiers-table" do
expect(page).to have_link(new_unfollow_dossier.id)
expect(page).to have_link(new_unfollow_dossier.id.to_s)
expect(page).to have_link(new_unfollow_dossier.user.email)
expect(page).to have_link(new_unfollow_dossier_2.id)
expect(page).to have_link(new_unfollow_dossier_2.id.to_s)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end
@ -61,20 +61,20 @@ feature "procedure filters" do
expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
within ".dossiers-table" do
expect(page).to have_link(new_unfollow_dossier.id, exact: true)
expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
expect(page).not_to have_link(new_unfollow_dossier_2.id, exact: true)
expect(page).not_to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).not_to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ.value)
within ".dossiers-table" do
expect(page).to have_link(new_unfollow_dossier.id)
expect(page).to have_link(new_unfollow_dossier.id.to_s)
expect(page).to have_link(new_unfollow_dossier.user.email)
expect(page).to have_link(new_unfollow_dossier_2.id)
expect(page).to have_link(new_unfollow_dossier_2.id.to_s)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end
@ -86,30 +86,30 @@ feature "procedure filters" do
expect(page).to have_content("#{type_de_champ.libelle} : #{champ.value}")
within ".dossiers-table" do
expect(page).to have_link(new_unfollow_dossier.id, exact: true)
expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ.value)
within ".dossiers-table" do
expect(page).not_to have_link(new_unfollow_dossier.id, exact: true)
expect(page).not_to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).not_to have_link(new_unfollow_dossier.user.email)
expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
remove_filter(champ_2.value)
within ".dossiers-table" do
expect(page).to have_link(new_unfollow_dossier.id, exact: true)
expect(page).to have_link(new_unfollow_dossier.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier.user.email)
expect(page).to have_link(new_unfollow_dossier_2.id, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.id.to_s, exact: true)
expect(page).to have_link(new_unfollow_dossier_2.user.email)
end
end

View file

@ -104,13 +104,13 @@ feature 'Invitations' do
def navigate_to_brouillon(dossier)
expect(page).to have_current_path(dossiers_path)
click_on(dossier.id)
click_on(dossier.id.to_s)
expect(page).to have_current_path(brouillon_dossier_path(dossier))
end
def navigate_to_dossier(dossier)
expect(page).to have_current_path(dossiers_path)
click_on(dossier.id)
click_on(dossier.id.to_s)
expect(page).to have_current_path(dossier_path(dossier))
end

View file

@ -24,13 +24,13 @@ describe 'users/dossiers/index.html.haml', type: :view do
it 'affiche les informations des dossiers' do
dossier = user_dossiers.first
expect(rendered).to have_text(dossier_brouillon.id)
expect(rendered).to have_text(dossier_brouillon.id.to_s)
expect(rendered).to have_text(dossier_brouillon.procedure.libelle)
expect(rendered).to have_link(dossier_brouillon.id, href: brouillon_dossier_path(dossier_brouillon))
expect(rendered).to have_link(dossier_brouillon.id.to_s, href: brouillon_dossier_path(dossier_brouillon))
expect(rendered).to have_text(dossier_en_construction.id)
expect(rendered).to have_text(dossier_en_construction.id.to_s)
expect(rendered).to have_text(dossier_en_construction.procedure.libelle)
expect(rendered).to have_link(dossier_en_construction.id, href: dossier_path(dossier_en_construction))
expect(rendered).to have_link(dossier_en_construction.id.to_s, href: dossier_path(dossier_en_construction))
end
context 'quand il ny a aucun dossier' do