|
95 | 95 |
|
96 | 96 | context 'filter by virtual attribute last_seen_at - without column&type properties (search by updated_at)' do
|
97 | 97 | 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)) |
100 | 101 |
|
101 | 102 | # chose 01 and 20 day of the current month
|
102 | 103 | page.find('input#q_last_seen_at_gteq_datetime_picker').click
|
|
118 | 119 | page.has_css?('h4', text: 'Current filters:')
|
119 | 120 | end
|
120 | 121 |
|
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 |
124 | 123 | 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) |
126 | 126 | end
|
127 | 127 |
|
128 | 128 | it 'input#value and placeholder is the same as before form submit' do
|
|
0 commit comments