Commit 75cbd2d8 authored by Coung Ngo's avatar Coung Ngo

Add iteration report path tests

Add tests to check that when iterations are clicked on
within groups and projects that they redirect the user
to the expected URLs
parent fc5cff46
......@@ -6,7 +6,7 @@ RSpec.describe 'Iterations list', :js do
let(:now) { Time.now }
let_it_be(:group) { create(:group) }
let_it_be(:user) { create(:user) }
let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now) }
let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now, title: 'Started iteration') }
let!(:upcoming_iteration) { create(:iteration, group: group, start_date: now + 1.day, due_date: now + 2.days) }
let!(:closed_iteration) { create(:closed_iteration, :skip_future_date_validation, group: group, start_date: now - 3.days, due_date: now - 2.days) }
......@@ -36,6 +36,16 @@ RSpec.describe 'Iterations list', :js do
expect(page).to have_link(upcoming_iteration.title)
expect(page).to have_link(closed_iteration.title)
end
context 'when an iteration is clicked' do
it 'redirects to an iteration report within the group context' do
click_link('Started iteration')
wait_for_requests
expect(page).to have_current_path(group_iteration_path(group, started_iteration.iid))
end
end
end
context 'as user' do
......
......@@ -7,7 +7,7 @@ RSpec.describe 'Iterations list', :js do
let_it_be(:group) { create(:group) }
let_it_be(:project) { create(:project, :public, group: group) }
let_it_be(:user) { create(:user) }
let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now) }
let!(:started_iteration) { create(:iteration, :skip_future_date_validation, group: group, start_date: now - 1.day, due_date: now, title: 'Started iteration') }
let!(:upcoming_iteration) { create(:iteration, group: group, start_date: now + 1.day, due_date: now + 2.days) }
let!(:closed_iteration) { create(:closed_iteration, :skip_future_date_validation, group: group, start_date: now - 3.days, due_date: now - 2.days) }
......@@ -33,6 +33,16 @@ RSpec.describe 'Iterations list', :js do
expect(page).to have_link(upcoming_iteration.title)
expect(page).to have_link(closed_iteration.title)
end
context 'when an iteration is clicked' do
it 'redirects to an iteration report within the project context' do
click_link('Started iteration')
wait_for_requests
expect(page).to have_current_path(project_iterations_inherited_path(project, started_iteration.id))
end
end
end
context 'as authorized user' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment