Skip to content

Commit fac8109

Browse files
committed
Fix and enchance flaky test
1 parent a769ed1 commit fac8109

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spec/filter_form_spec.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,9 @@
9595

9696
context 'filter by virtual attribute last_seen_at - without column&type properties (search by updated_at)' do
9797
before do
98-
@first_author = Author.create!(name: 'Ren', last_name: 'current', updated_at: Time.now.to_formatted_s(:db))
99-
@second_author = Author.create!(name: 'Rey', last_name: 'future', updated_at: 22.days.from_now.to_formatted_s(:db))
98+
@first_author = Author.create!(name: 'Ren', last_name: 'One', updated_at: Time.now.change(day: 1).to_formatted_s(:db))
99+
@second_author = Author.create!(name: 'Ron', last_name: 'Two', updated_at: Time.now.change(day: 20).to_formatted_s(:db))
100+
@third_author = Author.create!(name: 'Rey', last_name: 'future', updated_at: Time.now.change(day: 21).to_formatted_s(:db))
100101

101102
# chose 01 and 20 day of the current month
102103
page.find('input#q_last_seen_at_gteq_datetime_picker').click
@@ -118,11 +119,10 @@
118119
page.has_css?('h4', text: 'Current filters:')
119120
end
120121

121-
it 'should filter records properly' do
122-
puts @first_author.inspect
123-
puts @second_author.inspect
122+
it 'finds the first and second authors, but not the third one, because he is outside of the filtered dates' do
124123
expect(page).to have_text(@first_author.name)
125-
expect(page).not_to have_text(@second_author.name)
124+
expect(page).to have_text(@second_author.name)
125+
expect(page).not_to have_text(@third_author.name)
126126
end
127127

128128
it 'input#value and placeholder is the same as before form submit' do

0 commit comments

Comments
 (0)