Skip to content

Commit

Permalink
Use specific government in history mode spec
Browse files Browse the repository at this point in the history
This spec relies on a government existing at the date we specify which
caused this test to fail. By creating the government in the test we
resolve this complication.
  • Loading branch information
kevindew committed Dec 12, 2019
1 parent 5fda051 commit 6845130
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions spec/features/editing_content_settings/history_mode_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

RSpec.feature "History mode" do
scenario do
given_there_is_a_not_political_document
given_there_is_a_past_government
and_there_is_a_not_political_document
and_i_am_a_managing_editor
when_i_visit_the_summary_page
then_i_see_that_the_content_doesnt_get_history_mode
Expand All @@ -17,7 +18,15 @@
and_i_see_the_history_mode_banner
end

def given_there_is_a_not_political_document
def given_there_is_a_past_government
@government = build(:government,
started_on: Time.zone.parse("2006-01-01"),
ended_on: Time.zone.parse("2010-01-01"))

populate_government_bulk_data(@government)
end

def and_there_is_a_not_political_document
@edition = create(:edition, :not_political)
end

Expand Down Expand Up @@ -69,9 +78,9 @@ def when_i_click_to_backdate_the_content

def and_i_enter_a_date_to_backdate_the_content_to
@request = stub_publishing_api_put_content(@edition.content_id, {})
fill_in "backdate[date][day]", with: "1"
fill_in "backdate[date][month]", with: "1"
fill_in "backdate[date][year]", with: "1999"
fill_in "backdate[date][day]", with: @government.started_on.day
fill_in "backdate[date][month]", with: @government.started_on.month
fill_in "backdate[date][year]", with: @government.started_on.year
click_on "Save"
end

Expand Down

0 comments on commit 6845130

Please sign in to comment.