From 3afd08170da6f003b4f11ae1a3f737b14dedec40 Mon Sep 17 00:00:00 2001 From: Mehmet Beydogan Date: Thu, 10 Mar 2016 16:26:56 +0200 Subject: Add due_date:time field to Issue model Add due_date text field to sidebar issue#show Add ability sorting issues by due date ASC and DESC Add ability to filtering issues by No Due Date, Any Due Date, Due to tomorrow, Due in this week options Add handling issue due_date field for MergeRequest Update CHANGELOG Fix ambigous match for issues#show sidebar Fix SCREAMING_SNAKE_CASE offenses for due date contants Add specs for due date sorting and filtering on issues --- spec/features/issues_spec.rb | 63 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'spec') diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 35c8f93abc1..ac54a0c2719 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -153,6 +153,69 @@ describe 'Issues', feature: true do expect(first_issue).to include('baz') end + describe 'sorting by due date' do + before :each do + foo.due_date = 1.day.from_now + foo.save + bar.due_date = 6.days.from_now + bar.save + end + + it 'sorts by recently due date' do + visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_soon) + expect(first_issue).to include('foo') + end + + it 'sorts by least recently due date' do + visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + expect(first_issue).to include('bar') + end + + it 'sorts by least recently due date by excluding nil due dates' do + bar.update(due_date: nil) + visit namespace_project_issues_path(project.namespace, project, sort: sort_value_due_date_later) + expect(first_issue).to include('foo') + end + end + + describe 'filtering by due date' do + before :each do + foo.due_date = 1.day.from_now + foo.save + bar.due_date = 6.days.from_now + bar.save + end + + it 'filters by none' do + visit namespace_project_issues_path(project.namespace, project, due_date: Issue::NO_DUE_DATE[1]) + expect(page).not_to have_content("foo") + expect(page).not_to have_content("bar") + expect(page).to have_content("baz") + end + + it 'filters by any' do + visit namespace_project_issues_path(project.namespace, project, due_date: Issue::ANY_DUE_DATE[1]) + expect(page).to have_content("foo") + expect(page).to have_content("bar") + expect(page).to have_content("baz") + end + + it 'filters by due to tomorrow' do + visit namespace_project_issues_path(project.namespace, project, due_date: Date.tomorrow.to_s) + expect(page).to have_content("foo") + expect(page).not_to have_content("bar") + expect(page).not_to have_content("baz") + end + + it 'filters by due in this week' do + visit namespace_project_issues_path(project.namespace, project, due_date: 7.days.from_now.to_date.to_s) + expect(page).to have_content("foo") + expect(page).to have_content("bar") + expect(page).not_to have_content("baz") + end + + end + describe 'sorting by milestone' do before :each do foo.milestone = newer_due_milestone -- cgit v1.2.1