diff options
author | Jason Blanchard <jas.blanchard@gmail.com> | 2013-11-20 17:59:50 -0500 |
---|---|---|
committer | Jason Blanchard <jas.blanchard@gmail.com> | 2013-11-23 15:04:50 -0500 |
commit | b76948e6c92ce445249116ef86dbbd4d0b57573a (patch) | |
tree | bd731e10171339dc4e3ee8f09ee0673c0c22c469 /spec/features | |
parent | 983bf359945bc9d4ec1e9581e6bc35dac65e3a3b (diff) | |
download | gitlab-ce-b76948e6c92ce445249116ef86dbbd4d0b57573a.tar.gz |
Added sorting to project issues page
Diffstat (limited to 'spec/features')
-rw-r--r-- | spec/features/issues_spec.rb | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/spec/features/issues_spec.rb b/spec/features/issues_spec.rb index 8cb984946b4..5b1a14a1ca2 100644 --- a/spec/features/issues_spec.rb +++ b/spec/features/issues_spec.rb @@ -95,4 +95,87 @@ describe "Issues" do page.should have_content 'gitlab' end end + + describe 'filter issue' do + titles = ['foo','bar','baz'] + titles.each_with_index do |title, index| + let!(title.to_sym) { create(:issue, title: title, project: project, created_at: Time.now - (index * 60)) } + end + let(:newer_due_milestone) { create(:milestone, :due_date => '2013-12-11') } + let(:later_due_milestone) { create(:milestone, :due_date => '2013-12-12') } + + it 'sorts by newest' do + visit project_issues_path(project, sort: 'newest') + + page.should have_selector("ul.issues-list li:first-child", :text => 'foo') + page.should have_selector("ul.issues-list li:last-child", :text => 'baz') + end + + it 'sorts by oldest' do + visit project_issues_path(project, sort: 'oldest') + + page.should have_selector("ul.issues-list li:first-child", :text => 'baz') + page.should have_selector("ul.issues-list li:last-child", :text => 'foo') + end + + it 'sorts by most recently updated' do + baz.updated_at = Time.now + 100 + baz.save + visit project_issues_path(project, sort: 'recently_updated') + + page.should have_selector("ul.issues-list li:first-child", :text => 'baz') + end + + it 'sorts by least recently updated' do + baz.updated_at = Time.now - 100 + baz.save + visit project_issues_path(project, sort: 'last_updated') + + page.should have_selector("ul.issues-list li:first-child", :text => 'baz') + end + + describe 'sorting by milestone' do + + before :each do + foo.milestone = newer_due_milestone + foo.save + bar.milestone = later_due_milestone + bar.save + end + + it 'sorts by recently due milestone' do + visit project_issues_path(project, sort: 'milestone_due_soon') + + page.should have_selector("ul.issues-list li:first-child", :text => 'foo') + end + + it 'sorts by least recently due milestone' do + visit project_issues_path(project, sort: 'milestone_due_later') + + page.should have_selector("ul.issues-list li:first-child", :text => 'bar') + end + end + + describe 'combine filter and sort' do + + let(:user2) { create(:user) } + + before :each do + foo.assignee = user2 + foo.save + bar.assignee = user2 + bar.save + end + + it 'sorts with a filter applied' do + visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id) + + page.should have_selector("ul.issues-list li:first-child", :text => 'bar') + page.should have_selector("ul.issues-list li:last-child", :text => 'foo') + page.should_not have_content 'baz' + + end + end + end + end |