mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Convert to using symbols everywhere
This commit is contained in:
parent
fc17a03bc0
commit
63ac90ebb2
2 changed files with 12 additions and 19 deletions
|
|
@ -21,12 +21,12 @@ module Todos
|
|||
not_done_todos = not_done_todos.limit(sanitize(params[:limit])) if params[:limit]
|
||||
|
||||
if params[:due]
|
||||
due_within_when = Time.zone.now + params['due'].to_i.days
|
||||
due_within_when = Time.zone.now + params[:due].to_i.days
|
||||
not_done_todos = not_done_todos.where('todos.due <= ?', due_within_when)
|
||||
end
|
||||
|
||||
if params[:tag]
|
||||
tag = Tag.where(:name => params['tag']).first
|
||||
tag = Tag.where(:name => params[:tag]).first
|
||||
not_done_todos = not_done_todos.joins(:taggings).where('taggings.tag_id = ?', tag.id)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -32,17 +32,15 @@ module Todos
|
|||
|
||||
def test_filtering_by_due_date
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
# Only gets todos that are due today or are past their due date.
|
||||
undone_todos = UndoneTodosQuery.new(user).query(due: '0', 'due' => '0')
|
||||
undone_todos = UndoneTodosQuery.new(user).query(due: '0')
|
||||
expected = [todos(:package_delivered)]
|
||||
assert_equal expected, undone_todos.to_a
|
||||
end
|
||||
|
||||
def test_filtering_by_tag
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
undone_todos = UndoneTodosQuery.new(user).query(tag: 'bar', "tag" => "bar")
|
||||
undone_todos = UndoneTodosQuery.new(user).query(tag: 'bar')
|
||||
expected = [todos(:package_delivered),
|
||||
todos(:buy_tix)]
|
||||
assert_equal expected, undone_todos.to_a
|
||||
|
|
@ -50,8 +48,7 @@ module Todos
|
|||
|
||||
def test_filtering_by_context
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
undone_todos = UndoneTodosQuery.new(user).query(context_id: '11', 'context_id' => '11')
|
||||
undone_todos = UndoneTodosQuery.new(user).query(context_id: '11')
|
||||
expected = [todos(:package_delivered),
|
||||
todos(:pal_confirmation)]
|
||||
assert_equal expected, undone_todos.to_a
|
||||
|
|
@ -59,37 +56,33 @@ module Todos
|
|||
|
||||
def test_using_a_non_existant_context_raises_an_exception
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
undone_todos = UndoneTodosQuery.new(user).query(context_id: '110', 'context_id' => '110')
|
||||
undone_todos = UndoneTodosQuery.new(user).query(context_id: '110')
|
||||
end
|
||||
end
|
||||
|
||||
def test_filtering_by_project
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
undone_todos = UndoneTodosQuery.new(user).query(project_id: '5', 'project_id' => '5')
|
||||
undone_todos = UndoneTodosQuery.new(user).query(project_id: '5')
|
||||
expected = [todos(:package_delivered)]
|
||||
assert_equal expected, undone_todos.to_a
|
||||
end
|
||||
|
||||
def test_using_a_non_existant_project_raises_an_exception
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
assert_raises(ActiveRecord::RecordNotFound) do
|
||||
undone_todos = UndoneTodosQuery.new(user).query(project_id: '110', 'project_id' => '110')
|
||||
undone_todos = UndoneTodosQuery.new(user).query(project_id: '110')
|
||||
end
|
||||
end
|
||||
|
||||
def test_combination_of_all_params
|
||||
user = users(:other_user)
|
||||
# FIXME normalize HashWithIndifferentHash usage
|
||||
undone_todos = UndoneTodosQuery.new(user).query({
|
||||
limit: "1",
|
||||
project_id: "5", "project_id" => "5",
|
||||
context_id: "11", "context_id" => "11",
|
||||
tag: "bar", "tag" => "bar",
|
||||
due: "0", "due" => "0"})
|
||||
project_id: "5",
|
||||
context_id: "11",
|
||||
tag: "bar",
|
||||
due: "0"})
|
||||
expected = [todos(:package_delivered)]
|
||||
assert_equal expected, undone_todos.to_a
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue