Skip to content

Commit

Permalink
Improved tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaCheca authored and javierm committed Oct 3, 2018
1 parent bd0abf4 commit c03da34
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions spec/factories/legislations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,18 @@
result_publication_date { Date.current + 5.days }
end

trait :in_proposals_phase do
proposals_phase_start_date { Date.current - 1.day }
proposals_phase_end_date { Date.current + 2.days }
proposals_phase_enabled true
end

trait :upcoming_proposals_phase do
proposals_phase_start_date { Date.current + 1.day }
proposals_phase_end_date { Date.current + 2.days }
proposals_phase_enabled true
end

trait :published do
published true
end
Expand Down
4 changes: 2 additions & 2 deletions spec/features/legislation/processes_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@

context 'proposals phase' do
scenario 'not open' do
process = create(:legislation_process, proposals_phase_start_date: Date.current + 1.day, proposals_phase_end_date: Date.current + 2.days)
process = create(:legislation_process, :upcoming_proposals_phase)

visit legislation_process_proposals_path(process)

expect(page).to have_content("This phase is not open yet")
end

scenario 'open' do
process = create(:legislation_process, proposals_phase_start_date: Date.current - 1.day, proposals_phase_end_date: Date.current + 2.days, proposals_phase_enabled: true)
process = create(:legislation_process, :in_proposals_phase)

visit legislation_process_proposals_path(process)

Expand Down

0 comments on commit c03da34

Please sign in to comment.