Avoid explicity ID values on fixtures if possible

The specs don't care about the actual ID value, only about using the
same value. Fixed ID values cause flaky specs and high maintenance issues
This commit is contained in:
Bertocq
2018-03-08 14:42:48 +01:00
parent 5745c4dda7
commit d3a572e542

View File

@@ -359,9 +359,12 @@ feature 'Admin budget investments' do
end end
context 'Search' do context 'Search' do
let!(:first_investment) do
create(:budget_investment, title: 'Some other investment', budget: budget)
end
background do background do
create(:budget_investment, title: 'Some investment', budget: budget) create(:budget_investment, title: 'Some investment', budget: budget)
create(:budget_investment, title: 'Some other investment', budget: budget, id: 999999)
end end
scenario "Search investments by title" do scenario "Search investments by title" do
@@ -383,7 +386,7 @@ feature 'Admin budget investments' do
expect(page).to have_content('Some investment') expect(page).to have_content('Some investment')
expect(page).to have_content('Some other investment') expect(page).to have_content('Some other investment')
fill_in 'title_or_id', with: 999999 fill_in 'title_or_id', with: first_investment.id
click_button 'Search' click_button 'Search'
expect(page).to have_content('Some other investment') expect(page).to have_content('Some other investment')