Unverified Commit 44c55307 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Use 1.9 hash syntax for some tests


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 446d26399c55
......@@ -4,30 +4,29 @@
let(:user) { create(:user) }
let(:project) { create(:project, creator: user) }
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
describe 'sorting' do
it 'sorts by newest' do
params = {:sort => 'newest'}
params = {sort: 'newest'}
issues = Issues::ListContext.new(project, user, params).execute
issues.first.should eq foo
end
it 'sorts by oldest' do
params = {:sort => 'oldest'}
params = {sort: 'oldest'}
issues = Issues::ListContext.new(project, user, params).execute
issues.first.should eq baz
end
it 'sorts by recently updated' do
params = {:sort => 'recently_updated'}
params = {sort: 'recently_updated'}
baz.updated_at = Time.now + 10
baz.save
......@@ -36,7 +35,7 @@
end
it 'sorts by least recently updated' do
params = {:sort => 'last_updated'}
params = {sort: 'last_updated'}
bar.updated_at = Time.now - 10
bar.save
......@@ -45,9 +44,8 @@
end
describe 'sorting by milestone' do
let(:newer_due_milestone) { create(:milestone, :due_date => '2013-12-11') }
let(:later_due_milestone) { create(:milestone, :due_date => '2013-12-12') }
let(:newer_due_milestone) { create(:milestone, due_date: '2013-12-11') }
let(:later_due_milestone) { create(:milestone, due_date: '2013-12-12') }
before :each do
foo.milestone = newer_due_milestone
......@@ -57,7 +55,7 @@
end
it 'sorts by most recently due milestone' do
params = {:sort => 'milestone_due_soon'}
params = {sort: 'milestone_due_soon'}
issues = Issues::ListContext.new(project, user, params).execute
issues.first.should eq foo
......@@ -65,13 +63,11 @@
end
it 'sorts by least recently due milestone' do
params = {:sort => 'milestone_due_later'}
params = {sort: 'milestone_due_later'}
issues = Issues::ListContext.new(project, user, params).execute
issues.first.should eq bar
end
end
end
end
......@@ -101,21 +101,21 @@
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') }
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')
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')
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
......@@ -123,7 +123,7 @@
baz.save
visit project_issues_path(project, sort: 'recently_updated')
page.should have_selector("ul.issues-list li:first-child", :text => 'baz')
page.should have_selector("ul.issues-list li:first-child", text: 'baz')
end
it 'sorts by least recently updated' do
......@@ -131,12 +131,11 @@
baz.save
visit project_issues_path(project, sort: 'last_updated')
page.should have_selector("ul.issues-list li:first-child", :text => 'baz')
page.should have_selector("ul.issues-list li:first-child", text: 'baz')
end
describe 'sorting by milestone' do
before :each do
before :each do
foo.milestone = newer_due_milestone
foo.save
bar.milestone = later_due_milestone
......@@ -146,18 +145,17 @@
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')
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')
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
......@@ -170,12 +168,10 @@
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 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
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