Skip to content

Commit

Permalink
Fix rspec failing test and add test for date input field
Browse files Browse the repository at this point in the history
  • Loading branch information
jgreben committed Jul 11, 2018
1 parent b147fe4 commit 9051c53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/edi_error_reports/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<h1>EDIFACT invoice errors</h1>
<div>
<%= link_to 'Show errors for all days', { controller: 'edi_error_reports', action: 'index' }, class: 'btn btn-default', style: 'margin-bottom: 10px' %>
<%= link_to 'Show errors for today', { controller: 'edi_error_reports', action: 'index', day: "#{Date.today}" }, class: 'btn btn-default', style: 'margin-bottom: 10px' %>
<%= link_to 'Show errors for today', { controller: 'edi_error_reports', action: 'index', day: "#{Time.zone.today}" }, class: 'btn btn-default', style: 'margin-bottom: 10px' %>
</div>
<div class="field">
Show errors for selected date:
<%= date_field('edi_errors', 'day', value: params[:day] || "#{Date.today}",
<%= date_field('edi_errors', 'day', value: params[:day] || "#{Time.zone.today}",
'data-behavior': 'date-picker',
max: Time.zone.today) %>
</div>
Expand Down
5 changes: 5 additions & 0 deletions spec/features/edi_error_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
expect(page).to have_link('Show errors for today', href: "/edi_error_reports?day=#{Time.zone.today.to_date}")
end

it 'displays a date field to show all errors for the day' do
field = page.find_field('edi_errors_day').value.to_date
expect(field).to eq(Time.zone.today)
end

it 'displays the button to show all errors for all days' do
expect(page).to have_link('Show errors for all days', href: '/edi_error_reports')
end
Expand Down

0 comments on commit 9051c53

Please sign in to comment.