diff --git a/modules/backlogs/spec/features/burndown/show_spec.rb b/modules/backlogs/spec/features/burndown/show_spec.rb index c1c5f3d31307..f0b2dd431f6a 100644 --- a/modules/backlogs/spec/features/burndown/show_spec.rb +++ b/modules/backlogs/spec/features/burndown/show_spec.rb @@ -51,10 +51,10 @@ planning_page.click_in_sprint_menu(sprint, "Burndown chart") expect(page) - .to have_content(sprint.name) + .to have_heading(sprint.name, level: 2) expect(page) - .to have_content "#{format_date(sprint.start_date)} – #{format_date(sprint.finish_date)}" + .to have_content "#{sprint.start_date.strftime('%m/%d/%Y')} – #{sprint.finish_date.strftime('%m/%d/%Y')}" expect(page) - .to have_css "opce-burndown-chart" + .to have_element :"opce-burndown-chart" end end diff --git a/modules/backlogs/spec/models/burndown_spec.rb b/modules/backlogs/spec/models/burndown_spec.rb index 34a844f493d5..4cecac0c8d81 100644 --- a/modules/backlogs/spec/models/burndown_spec.rb +++ b/modules/backlogs/spec/models/burndown_spec.rb @@ -45,10 +45,10 @@ def set_attribute_journalized(story, attribute, value, day) let!(:non_working_days) do [ - create(:non_working_day, date: Date.new(2011, 4, 2)), - create(:non_working_day, date: Date.new(2011, 4, 3)), - create(:non_working_day, date: Date.new(2011, 4, 9)), - create(:non_working_day, date: Date.new(2011, 4, 10)) + create(:non_working_day, date: Date.new(2011, 4, 2)), # Saturday + create(:non_working_day, date: Date.new(2011, 4, 3)), # Sunday + create(:non_working_day, date: Date.new(2011, 4, 9)), # Saturday + create(:non_working_day, date: Date.new(2011, 4, 10)) # Sunday ] end @@ -72,9 +72,8 @@ def set_attribute_journalized(story, attribute, value, day) end describe "WITH the today date fixed to April 4th, 2011 and having a 10 (working days) sprint" do - before do - allow(Time).to receive(:now).and_return(Time.utc(2011, "apr", 4, 20, 15, 1)) - allow(Date).to receive(:today).and_return(Date.civil(2011, 4, 4)) + around do |example| + travel_to(Time.utc(2011, "apr", 4, 20, 15, 1)) { example.run } end describe "WITH having a version in the future" do @@ -196,9 +195,8 @@ def set_attribute_journalized(story, attribute, value, day) let(:sprint) { create(:agile_sprint, project:) } describe "WITH the today date fixed to April 4th, 2011 and having a 10 (working days) sprint" do - before do - allow(Time).to receive(:now).and_return(Time.utc(2011, "apr", 4, 20, 15, 1)) - allow(Date).to receive(:today).and_return(Date.civil(2011, 4, 4)) + around do |example| + travel_to(Time.utc(2011, "apr", 4, 20, 15, 1)) { example.run } end describe "WITH having a sprint in the future" do