Commit 44c55307a0dc1d011cb9deabb2f1d631ebd2cb63
1 parent
526c2fdf
Exists in
master
and in
4 other branches
Use 1.9 hash syntax for some tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Showing
2 changed files
with
23 additions
and
31 deletions
Show diff stats
spec/contexts/issues/list_context_spec.rb
| ... | ... | @@ -4,30 +4,29 @@ describe Issues::ListContext do |
| 4 | 4 | |
| 5 | 5 | let(:user) { create(:user) } |
| 6 | 6 | let(:project) { create(:project, creator: user) } |
| 7 | - | |
| 7 | + | |
| 8 | 8 | titles = ['foo','bar','baz'] |
| 9 | 9 | titles.each_with_index do |title, index| |
| 10 | 10 | let!(title.to_sym) { create(:issue, title: title, project: project, created_at: Time.now - (index * 60)) } |
| 11 | 11 | end |
| 12 | 12 | |
| 13 | 13 | describe 'sorting' do |
| 14 | - | |
| 15 | 14 | it 'sorts by newest' do |
| 16 | - params = {:sort => 'newest'} | |
| 15 | + params = {sort: 'newest'} | |
| 17 | 16 | |
| 18 | 17 | issues = Issues::ListContext.new(project, user, params).execute |
| 19 | 18 | issues.first.should eq foo |
| 20 | 19 | end |
| 21 | 20 | |
| 22 | 21 | it 'sorts by oldest' do |
| 23 | - params = {:sort => 'oldest'} | |
| 22 | + params = {sort: 'oldest'} | |
| 24 | 23 | |
| 25 | 24 | issues = Issues::ListContext.new(project, user, params).execute |
| 26 | 25 | issues.first.should eq baz |
| 27 | 26 | end |
| 28 | 27 | |
| 29 | 28 | it 'sorts by recently updated' do |
| 30 | - params = {:sort => 'recently_updated'} | |
| 29 | + params = {sort: 'recently_updated'} | |
| 31 | 30 | baz.updated_at = Time.now + 10 |
| 32 | 31 | baz.save |
| 33 | 32 | |
| ... | ... | @@ -36,7 +35,7 @@ describe Issues::ListContext do |
| 36 | 35 | end |
| 37 | 36 | |
| 38 | 37 | it 'sorts by least recently updated' do |
| 39 | - params = {:sort => 'last_updated'} | |
| 38 | + params = {sort: 'last_updated'} | |
| 40 | 39 | bar.updated_at = Time.now - 10 |
| 41 | 40 | bar.save |
| 42 | 41 | |
| ... | ... | @@ -45,9 +44,8 @@ describe Issues::ListContext do |
| 45 | 44 | end |
| 46 | 45 | |
| 47 | 46 | describe 'sorting by milestone' do |
| 48 | - | |
| 49 | - let(:newer_due_milestone) { create(:milestone, :due_date => '2013-12-11') } | |
| 50 | - let(:later_due_milestone) { create(:milestone, :due_date => '2013-12-12') } | |
| 47 | + let(:newer_due_milestone) { create(:milestone, due_date: '2013-12-11') } | |
| 48 | + let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } | |
| 51 | 49 | |
| 52 | 50 | before :each do |
| 53 | 51 | foo.milestone = newer_due_milestone |
| ... | ... | @@ -57,7 +55,7 @@ describe Issues::ListContext do |
| 57 | 55 | end |
| 58 | 56 | |
| 59 | 57 | it 'sorts by most recently due milestone' do |
| 60 | - params = {:sort => 'milestone_due_soon'} | |
| 58 | + params = {sort: 'milestone_due_soon'} | |
| 61 | 59 | |
| 62 | 60 | issues = Issues::ListContext.new(project, user, params).execute |
| 63 | 61 | issues.first.should eq foo |
| ... | ... | @@ -65,13 +63,11 @@ describe Issues::ListContext do |
| 65 | 63 | end |
| 66 | 64 | |
| 67 | 65 | it 'sorts by least recently due milestone' do |
| 68 | - params = {:sort => 'milestone_due_later'} | |
| 66 | + params = {sort: 'milestone_due_later'} | |
| 69 | 67 | |
| 70 | 68 | issues = Issues::ListContext.new(project, user, params).execute |
| 71 | 69 | issues.first.should eq bar |
| 72 | 70 | end |
| 73 | - | |
| 74 | 71 | end |
| 75 | 72 | end |
| 76 | - | |
| 77 | 73 | end | ... | ... |
spec/features/issues_spec.rb
| ... | ... | @@ -101,21 +101,21 @@ describe "Issues" do |
| 101 | 101 | titles.each_with_index do |title, index| |
| 102 | 102 | let!(title.to_sym) { create(:issue, title: title, project: project, created_at: Time.now - (index * 60)) } |
| 103 | 103 | end |
| 104 | - let(:newer_due_milestone) { create(:milestone, :due_date => '2013-12-11') } | |
| 105 | - let(:later_due_milestone) { create(:milestone, :due_date => '2013-12-12') } | |
| 104 | + let(:newer_due_milestone) { create(:milestone, due_date: '2013-12-11') } | |
| 105 | + let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') } | |
| 106 | 106 | |
| 107 | 107 | it 'sorts by newest' do |
| 108 | 108 | visit project_issues_path(project, sort: 'newest') |
| 109 | - | |
| 110 | - page.should have_selector("ul.issues-list li:first-child", :text => 'foo') | |
| 111 | - page.should have_selector("ul.issues-list li:last-child", :text => 'baz') | |
| 109 | + | |
| 110 | + page.should have_selector("ul.issues-list li:first-child", text: 'foo') | |
| 111 | + page.should have_selector("ul.issues-list li:last-child", text: 'baz') | |
| 112 | 112 | end |
| 113 | 113 | |
| 114 | 114 | it 'sorts by oldest' do |
| 115 | 115 | visit project_issues_path(project, sort: 'oldest') |
| 116 | 116 | |
| 117 | - page.should have_selector("ul.issues-list li:first-child", :text => 'baz') | |
| 118 | - page.should have_selector("ul.issues-list li:last-child", :text => 'foo') | |
| 117 | + page.should have_selector("ul.issues-list li:first-child", text: 'baz') | |
| 118 | + page.should have_selector("ul.issues-list li:last-child", text: 'foo') | |
| 119 | 119 | end |
| 120 | 120 | |
| 121 | 121 | it 'sorts by most recently updated' do |
| ... | ... | @@ -123,7 +123,7 @@ describe "Issues" do |
| 123 | 123 | baz.save |
| 124 | 124 | visit project_issues_path(project, sort: 'recently_updated') |
| 125 | 125 | |
| 126 | - page.should have_selector("ul.issues-list li:first-child", :text => 'baz') | |
| 126 | + page.should have_selector("ul.issues-list li:first-child", text: 'baz') | |
| 127 | 127 | end |
| 128 | 128 | |
| 129 | 129 | it 'sorts by least recently updated' do |
| ... | ... | @@ -131,12 +131,11 @@ describe "Issues" do |
| 131 | 131 | baz.save |
| 132 | 132 | visit project_issues_path(project, sort: 'last_updated') |
| 133 | 133 | |
| 134 | - page.should have_selector("ul.issues-list li:first-child", :text => 'baz') | |
| 134 | + page.should have_selector("ul.issues-list li:first-child", text: 'baz') | |
| 135 | 135 | end |
| 136 | 136 | |
| 137 | 137 | describe 'sorting by milestone' do |
| 138 | - | |
| 139 | - before :each do | |
| 138 | + before :each do | |
| 140 | 139 | foo.milestone = newer_due_milestone |
| 141 | 140 | foo.save |
| 142 | 141 | bar.milestone = later_due_milestone |
| ... | ... | @@ -146,18 +145,17 @@ describe "Issues" do |
| 146 | 145 | it 'sorts by recently due milestone' do |
| 147 | 146 | visit project_issues_path(project, sort: 'milestone_due_soon') |
| 148 | 147 | |
| 149 | - page.should have_selector("ul.issues-list li:first-child", :text => 'foo') | |
| 148 | + page.should have_selector("ul.issues-list li:first-child", text: 'foo') | |
| 150 | 149 | end |
| 151 | 150 | |
| 152 | 151 | it 'sorts by least recently due milestone' do |
| 153 | 152 | visit project_issues_path(project, sort: 'milestone_due_later') |
| 154 | 153 | |
| 155 | - page.should have_selector("ul.issues-list li:first-child", :text => 'bar') | |
| 154 | + page.should have_selector("ul.issues-list li:first-child", text: 'bar') | |
| 156 | 155 | end |
| 157 | 156 | end |
| 158 | 157 | |
| 159 | 158 | describe 'combine filter and sort' do |
| 160 | - | |
| 161 | 159 | let(:user2) { create(:user) } |
| 162 | 160 | |
| 163 | 161 | before :each do |
| ... | ... | @@ -170,12 +168,10 @@ describe "Issues" do |
| 170 | 168 | it 'sorts with a filter applied' do |
| 171 | 169 | visit project_issues_path(project, sort: 'oldest', assignee_id: user2.id) |
| 172 | 170 | |
| 173 | - page.should have_selector("ul.issues-list li:first-child", :text => 'bar') | |
| 174 | - page.should have_selector("ul.issues-list li:last-child", :text => 'foo') | |
| 171 | + page.should have_selector("ul.issues-list li:first-child", text: 'bar') | |
| 172 | + page.should have_selector("ul.issues-list li:last-child", text: 'foo') | |
| 175 | 173 | page.should_not have_content 'baz' |
| 176 | - | |
| 177 | 174 | end |
| 178 | 175 | end |
| 179 | 176 | end |
| 180 | - | |
| 181 | 177 | end | ... | ... |