From d3a572e542250221b1664f75cf2ba8d8d5cb595f Mon Sep 17 00:00:00 2001 From: Bertocq Date: Thu, 8 Mar 2018 14:42:48 +0100 Subject: [PATCH] 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 --- spec/features/admin/budget_investments_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/budget_investments_spec.rb b/spec/features/admin/budget_investments_spec.rb index 18b82cf9e..b9ce3bb1e 100644 --- a/spec/features/admin/budget_investments_spec.rb +++ b/spec/features/admin/budget_investments_spec.rb @@ -359,9 +359,12 @@ feature 'Admin budget investments' do end context 'Search' do + let!(:first_investment) do + create(:budget_investment, title: 'Some other investment', budget: budget) + end + background do create(:budget_investment, title: 'Some investment', budget: budget) - create(:budget_investment, title: 'Some other investment', budget: budget, id: 999999) end 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 other investment') - fill_in 'title_or_id', with: 999999 + fill_in 'title_or_id', with: first_investment.id click_button 'Search' expect(page).to have_content('Some other investment')