mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-20 17:20:12 +01:00
Revert breaking commits
This reverts the following commits:319d4b00cd403cc1015e37485013a0d08ffb3806
This commit is contained in:
parent
55e28d90a9
commit
1dbef179a7
8 changed files with 81 additions and 301 deletions
|
|
@ -1051,7 +1051,7 @@ end
|
||||||
if recurring_todo.todos.active.count == 0
|
if recurring_todo.todos.active.count == 0
|
||||||
|
|
||||||
# check for next todo either from the due date or the show_from date
|
# check for next todo either from the due date or the show_from date
|
||||||
date_to_check = todo.due.nil? ? todo.show_from.localtime : todo.due.localtime
|
date_to_check = todo.due.nil? ? todo.show_from : todo.due
|
||||||
|
|
||||||
# if both due and show_from are nil, check for a next todo from now
|
# if both due and show_from are nil, check for a next todo from now
|
||||||
date_to_check = Time.zone.now if date_to_check.nil?
|
date_to_check = Time.zone.now if date_to_check.nil?
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ module RecurringTodos
|
||||||
# TODO: recheck if future rails versions have this problem too
|
# TODO: recheck if future rails versions have this problem too
|
||||||
start = Time.utc(start.year, start.month, start.day)+n.months
|
start = Time.utc(start.year, start.month, start.day)+n.months
|
||||||
end
|
end
|
||||||
Time.zone.local(start.year, start.month, every_x_day).localtime.at_midnight
|
Time.zone.local(start.year, start.month, every_x_day)
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_relative_day_of_month(start, n)
|
def find_relative_day_of_month(start, n)
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# mark as active
|
# mark as active
|
||||||
xhr :post, :toggle_check, :id=>1, :_source_view=>""
|
xhr :post, :toggle_check, :id=>1, :_source_view=>""
|
||||||
|
|
||||||
recurring_todo_1 = RecurringTodo.find(1) # reload seems to not work
|
recurring_todo_1 = RecurringTodo.find(1) # reload seems to not work
|
||||||
assert recurring_todo_1.active?, "recurring todo should be active but is #{recurring_todo_1.aasm.current_state}"
|
assert recurring_todo_1.active?, "recurring todo should be active but is #{recurring_todo_1.aasm.current_state}"
|
||||||
|
|
||||||
|
|
@ -260,7 +260,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
||||||
"recurring_show_days_before"=>"0",
|
"recurring_show_days_before"=>"0",
|
||||||
"recurring_target"=>"due_date",
|
"recurring_target"=>"due_date",
|
||||||
"recurring_show_always" => "1",
|
"recurring_show_always" => "1",
|
||||||
"start_from"=>"1/10/2012",
|
"start_from"=>"1/10/2012",
|
||||||
"weekly_every_x_week"=>"1",
|
"weekly_every_x_week"=>"1",
|
||||||
"weekly_return_monday"=>"w",
|
"weekly_return_monday"=>"w",
|
||||||
"yearly_day_of_week"=>"0",
|
"yearly_day_of_week"=>"0",
|
||||||
|
|
@ -379,9 +379,9 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
||||||
"tag_list"=>"one, two, three, four", format: :js
|
"tag_list"=>"one, two, three, four", format: :js
|
||||||
|
|
||||||
assert_equal "new recurrence pattern", assigns['recurring_todo'].description
|
assert_equal "new recurrence pattern", assigns['recurring_todo'].description
|
||||||
assert_equal "2013-01-02", assigns['recurring_todo'].start_from.localtime.to_date.to_s
|
assert_equal "2013-01-02 00:00:00 +0000", assigns['recurring_todo'].start_from.to_s
|
||||||
todo = assigns['recurring_todo'].todos.first
|
todo = assigns['recurring_todo'].todos.first
|
||||||
assert_equal "2013-01-02", todo.show_from.localtime.to_date.to_s
|
assert_equal "2013-01-02 00:00:00 +0000", todo.show_from.to_s
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -419,9 +419,9 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
rt = recurring_todos(:call_bill_gates_every_day)
|
rt = recurring_todos(:call_bill_gates_every_day)
|
||||||
|
|
||||||
put :update,
|
put :update,
|
||||||
"recurring_todo" => {
|
"recurring_todo" => {
|
||||||
"description" => "changed",
|
"description" => "changed",
|
||||||
"daily_selector" => "daily_every_x_day",
|
"daily_selector" => "daily_every_x_day",
|
||||||
"daily_every_x_days" => "2",
|
"daily_every_x_days" => "2",
|
||||||
"ends_on" => "no_end_date",
|
"ends_on" => "no_end_date",
|
||||||
|
|
@ -433,7 +433,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
||||||
"recurring_todo_edit_start_from" => "2/1/2013",
|
"recurring_todo_edit_start_from" => "2/1/2013",
|
||||||
"end_date" => nil,
|
"end_date" => nil,
|
||||||
"ends_on" => "no_end_date",
|
"ends_on" => "no_end_date",
|
||||||
"id" => "#{rt.id}",
|
"id" => "#{rt.id}",
|
||||||
"context_name" => "library",
|
"context_name" => "library",
|
||||||
format: :js
|
format: :js
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
totals = assigns['stats'].totals
|
totals = assigns['stats'].totals
|
||||||
assert_equal 4, totals.tags
|
assert_equal 4, totals.tags
|
||||||
assert_equal 2, totals.unique_tags
|
assert_equal 2, totals.unique_tags
|
||||||
assert_equal 2.weeks.ago.localtime.at_midnight, totals.first_action_at.localtime.at_midnight
|
assert_equal 2.week.ago.utc.at_midnight, totals.first_action_at.utc.at_midnight
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_downdrill
|
def test_downdrill
|
||||||
|
|
@ -128,15 +128,15 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
# And they should be averaged over three months
|
# And they should be averaged over three months
|
||||||
assert_equal 2/3.0, assigns['actions_done_avg_last12months_array'][1], "fourth month should be excluded"
|
assert_equal 2/3.0, assigns['actions_done_avg_last12months_array'][1], "fourth month should be excluded"
|
||||||
assert_equal 2/3.0, assigns['actions_done_avg_last12months_array'][2], "fourth month should be included"
|
assert_equal 2/3.0, assigns['actions_done_avg_last12months_array'][2], "fourth month should be included"
|
||||||
|
|
||||||
assert_equal (3)/3.0, assigns['actions_created_avg_last12months_array'][1], "one every month"
|
assert_equal (3)/3.0, assigns['actions_created_avg_last12months_array'][1], "one every month"
|
||||||
assert_equal (4)/3.0, assigns['actions_created_avg_last12months_array'][2], "two in fourth month"
|
assert_equal (4)/3.0, assigns['actions_created_avg_last12months_array'][2], "two in fourth month"
|
||||||
|
|
||||||
# And the current month should be interpolated
|
# And the current month should be interpolated
|
||||||
fraction = Time.zone.now.day.to_f / Time.zone.now.end_of_month.day.to_f
|
fraction = Time.zone.now.day.to_f / Time.zone.now.end_of_month.day.to_f
|
||||||
assert_equal (2*(1/fraction)+2)/3.0, assigns['interpolated_actions_created_this_month'], "two this month and one in the last two months"
|
assert_equal (2*(1/fraction)+2)/3.0, assigns['interpolated_actions_created_this_month'], "two this month and one in the last two months"
|
||||||
assert_equal (2)/3.0, assigns['interpolated_actions_done_this_month'], "none this month and one two the last two months"
|
assert_equal (2)/3.0, assigns['interpolated_actions_done_this_month'], "none this month and one two the last two months"
|
||||||
|
|
||||||
# And totals should be calculated
|
# And totals should be calculated
|
||||||
assert_equal 2, assigns['max'], "max of created or completed todos in one month"
|
assert_equal 2, assigns['max'], "max of created or completed todos in one month"
|
||||||
end
|
end
|
||||||
|
|
@ -168,7 +168,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -176,7 +176,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# only tests relevant differences with actions_done_last_12months_data
|
# only tests relevant differences with actions_done_last_12months_data
|
||||||
|
|
||||||
assert_equal 31, assigns['actions_done_last30days_array'].size, "30 complete days plus 1 for the current day"
|
assert_equal 31, assigns['actions_done_last30days_array'].size, "30 complete days plus 1 for the current day"
|
||||||
assert_equal 2, assigns['max'], "two actions created on one day is max"
|
assert_equal 2, assigns['max'], "two actions created on one day is max"
|
||||||
end
|
end
|
||||||
|
|
@ -185,31 +185,31 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
get :actions_done_lastyears_data
|
get :actions_done_lastyears_data
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# only tests difference with actions_done_last_12months_data
|
# only tests difference with actions_done_last_12months_data
|
||||||
|
|
||||||
# And the last two months are corrected
|
# And the last two months are corrected
|
||||||
assert_equal 2/3.0, assigns['actions_done_avg_last_months_array'][23]
|
assert_equal 2/3.0, assigns['actions_done_avg_last_months_array'][23]
|
||||||
assert_equal 2/3.0, assigns['actions_done_avg_last_months_array'][24]
|
assert_equal 2/3.0, assigns['actions_done_avg_last_months_array'][24]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_actions_completion_time_data
|
def test_actions_completion_time_data
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
get :actions_completion_time_data
|
get :actions_completion_time_data
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# do not test stuff already implicitly tested in other tests
|
# do not test stuff already implicitly tested in other tests
|
||||||
assert_equal 104, assigns['max_weeks'], "two years is 104 weeks (for completed_at)"
|
assert_equal 104, assigns['max_weeks'], "two years is 104 weeks (for completed_at)"
|
||||||
assert_equal 3, assigns['max_actions'], "3 completed within one week"
|
assert_equal 3, assigns['max_actions'], "3 completed within one week"
|
||||||
|
|
@ -222,13 +222,13 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
get :actions_running_time_data
|
get :actions_running_time_data
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# do not test stuff already implicitly tested in other tests
|
# do not test stuff already implicitly tested in other tests
|
||||||
assert_equal 17, assigns['max_weeks'], "there are actions in the first 17 weeks of this year"
|
assert_equal 17, assigns['max_weeks'], "there are actions in the first 17 weeks of this year"
|
||||||
assert_equal 2, assigns['max_actions'], "2 actions running long together"
|
assert_equal 2, assigns['max_actions'], "2 actions running long together"
|
||||||
|
|
@ -241,13 +241,13 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
get :actions_open_per_week_data
|
get :actions_open_per_week_data
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
||||||
# do not test stuff already implicitly tested in other tests
|
# do not test stuff already implicitly tested in other tests
|
||||||
assert_equal 17, assigns['max_weeks'], "there are actions in the first 17 weeks of this year"
|
assert_equal 17, assigns['max_weeks'], "there are actions in the first 17 weeks of this year"
|
||||||
assert_equal 4, assigns['max_actions'], "4 actions running together"
|
assert_equal 4, assigns['max_actions'], "4 actions running together"
|
||||||
|
|
@ -258,12 +258,12 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
# Given todo1 is deferred (i.e. not visible)
|
# Given todo1 is deferred (i.e. not visible)
|
||||||
@todo_today1.show_from = Time.zone.now + 1.week
|
@todo_today1.show_from = Time.zone.now + 1.week
|
||||||
@todo_today1.save
|
@todo_today1.save
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
get :actions_visible_running_time_data
|
get :actions_visible_running_time_data
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
@ -281,7 +281,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -311,7 +311,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -335,12 +335,12 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
assert_equal 14, assigns['data'].values[9], "pie slices limited to max 10; last pie contains sum of rest (in percentage)"
|
assert_equal 14, assigns['data'].values[9], "pie slices limited to max 10; last pie contains sum of rest (in percentage)"
|
||||||
assert_equal "(others)", assigns['data'].labels[9], "pie slices limited to max 10; last slice contains label for others"
|
assert_equal "(others)", assigns['data'].labels[9], "pie slices limited to max 10; last slice contains label for others"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_actions_day_of_week_all_data
|
def test_actions_day_of_week_all_data
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -358,7 +358,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -376,7 +376,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -389,12 +389,12 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
assert_not_nil assigns['actions_creation_hour_array']
|
assert_not_nil assigns['actions_creation_hour_array']
|
||||||
assert_not_nil assigns['actions_completion_hour_array']
|
assert_not_nil assigns['actions_completion_hour_array']
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show_selected_actions_from_chart_avrt
|
def test_show_selected_actions_from_chart_avrt
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -409,7 +409,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -424,7 +424,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -439,7 +439,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
login_as(:admin_user)
|
login_as(:admin_user)
|
||||||
@current_user = User.find(users(:admin_user).id)
|
@current_user = User.find(users(:admin_user).id)
|
||||||
@current_user.todos.delete_all
|
@current_user.todos.delete_all
|
||||||
|
|
||||||
given_todos_for_stats
|
given_todos_for_stats
|
||||||
|
|
||||||
# When I get the chart data
|
# When I get the chart data
|
||||||
|
|
@ -451,7 +451,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def given_todos_for_stats
|
def given_todos_for_stats
|
||||||
# Given two todos created today
|
# Given two todos created today
|
||||||
@todo_today1 = @current_user.todos.create!(:description => "created today1", :context => contexts(:office))
|
@todo_today1 = @current_user.todos.create!(:description => "created today1", :context => contexts(:office))
|
||||||
|
|
@ -491,7 +491,7 @@ class StatsControllerTest < ActionController::TestCase
|
||||||
def difference_in_days(date1, date2)
|
def difference_in_days(date1, date2)
|
||||||
return ((date1.at_midnight-date2.at_midnight)/(60*60*24)).to_i
|
return ((date1.at_midnight-date2.at_midnight)/(60*60*24)).to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
# assumes date1 > date2
|
# assumes date1 > date2
|
||||||
def difference_in_weeks(date1, date2)
|
def difference_in_weeks(date1, date2)
|
||||||
return difference_in_days(date1, date2) / 7
|
return difference_in_days(date1, date2) / 7
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
assert_response :success
|
assert_response :success
|
||||||
assert_equal 3, @tagged
|
assert_equal 3, @tagged
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_find_tagged_with_terms_separated_with_dot
|
def test_find_tagged_with_terms_separated_with_dot
|
||||||
login_as :admin_user
|
login_as :admin_user
|
||||||
create_todo(description: "test dotted tag", tag_list: "first.last, second")
|
create_todo(description: "test dotted tag", tag_list: "first.last, second")
|
||||||
|
|
@ -408,7 +408,7 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
#######
|
#######
|
||||||
# defer
|
# defer
|
||||||
#######
|
#######
|
||||||
|
|
||||||
def test_update_clearing_show_from_makes_todo_active
|
def test_update_clearing_show_from_makes_todo_active
|
||||||
t = Todo.find(1)
|
t = Todo.find(1)
|
||||||
|
|
@ -437,7 +437,7 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
# given a todo in the tickler that should be activated
|
# given a todo in the tickler that should be activated
|
||||||
travel_to 2.weeks.ago do
|
travel_to 2.weeks.ago do
|
||||||
create_todo(
|
create_todo(
|
||||||
description: "tickler",
|
description: "tickler",
|
||||||
show_from: 1.week.from_now.
|
show_from: 1.week.from_now.
|
||||||
in_time_zone(users(:admin_user).prefs.time_zone).
|
in_time_zone(users(:admin_user).prefs.time_zone).
|
||||||
strftime("#{users(:admin_user).prefs.date_format}"))
|
strftime("#{users(:admin_user).prefs.date_format}"))
|
||||||
|
|
@ -740,14 +740,14 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
|
|
||||||
# locate the new todo in tickler
|
# locate the new todo in tickler
|
||||||
new_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'deferred').first
|
new_todo = Todo.where(:recurring_todo_id => recurring_todo_1.id, :state => 'deferred').first
|
||||||
refute new_todo.nil?, "the todo should be in the tickler"
|
assert !new_todo.nil?, "the todo should be in the tickler"
|
||||||
|
|
||||||
assert_equal "Call Bill Gates every day", new_todo.description
|
assert_equal "Call Bill Gates every day", new_todo.description
|
||||||
assert_not_equal todo_1.id, new_todo.id, "check that the new todo is not the same as todo_1"
|
assert_not_equal todo_1.id, new_todo.id, "check that the new todo is not the same as todo_1"
|
||||||
refute new_todo.show_from.nil?, "check that the new_todo is in the tickler to show next month"
|
assert !new_todo.show_from.nil?, "check that the new_todo is in the tickler to show next month"
|
||||||
|
|
||||||
# do not use today here. It somehow gets messed up with the timezone calculation.
|
# do not use today here. It somehow gets messed up with the timezone calculation.
|
||||||
next_month = (today + 1.month).localtime.at_midnight
|
next_month = (Time.zone.now + 1.month).at_midnight
|
||||||
|
|
||||||
assert_equal next_month.utc.to_date.to_s(:db), new_todo.show_from.utc.to_date.to_s(:db)
|
assert_equal next_month.utc.to_date.to_s(:db), new_todo.show_from.utc.to_date.to_s(:db)
|
||||||
end
|
end
|
||||||
|
|
@ -1024,13 +1024,13 @@ class TodosControllerTest < ActionController::TestCase
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_todo(params={})
|
def create_todo(params={})
|
||||||
defaults = { source_view: 'todo',
|
defaults = { source_view: 'todo',
|
||||||
context_name: "library", project_name: "Build a working time machine",
|
context_name: "library", project_name: "Build a working time machine",
|
||||||
notes: "note", description: "a new todo", due: nil, tag_list: "a,b,c"}
|
notes: "note", description: "a new todo", due: nil, tag_list: "a,b,c"}
|
||||||
|
|
||||||
params=params.reverse_merge(defaults)
|
params=params.reverse_merge(defaults)
|
||||||
|
|
||||||
put :create, _source_view: params[:_source_view],
|
put :create, _source_view: params[:_source_view],
|
||||||
context_name: params[:context_name], project_name: params[:project_name], tag_list: params[:tag_list],
|
context_name: params[:context_name], project_name: params[:project_name], tag_list: params[:tag_list],
|
||||||
todo: {notes: params[:notes], description: params[:description], due: params[:due], show_from: params[:show_from]}
|
todo: {notes: params[:notes], description: params[:description], due: params[:due], show_from: params[:show_from]}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
220
test/fixtures/tracks_last_mail.log.old
vendored
220
test/fixtures/tracks_last_mail.log.old
vendored
|
|
@ -1,220 +0,0 @@
|
||||||
Received: from mail-qc0-f175.google.com (mail-qc0-f175.google.com [209.85.216.175])
|
|
||||||
by gandalf.balt.nu (8.14.8/8.14.8) with ESMTP id s8O9DEa3032594
|
|
||||||
for <task@balt-nu.xs4all.nl>; Wed, 24 Sep 2014 11:13:14 +0200
|
|
||||||
Received: by mail-qc0-f175.google.com with SMTP id o8so3072914qcw.34
|
|
||||||
for <task@balt-nu.xs4all.nl>; Wed, 24 Sep 2014 02:13:13 -0700 (PDT)
|
|
||||||
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
||||||
d=1e100.net; s=20130820;
|
|
||||||
h=x-gm-message-state:delivered-to:dkim-signature:from:to:references
|
|
||||||
:in-reply-to:subject:date:message-id:mime-version:content-type
|
|
||||||
:thread-index:content-language;
|
|
||||||
bh=nWJv3oQMsXP4/5/l+eXcFEElvo9gGf/EHfJDdpLbUTc=;
|
|
||||||
b=j2DqxKCqpeb0eAhyrY6LKpDbLMfDzg+szNUJcQ+7eV2BCCv9b4HidkbrPtUbfHLzfm
|
|
||||||
kKwvWpSARQhL68IJAcWJLR/8s0VljETtLYhHW9rKaZIiY61nTDwhomzBZ30UqWpTRwne
|
|
||||||
p9aY3z11NCjP1rwIHzcoSIpdPVt54Pt0dkA6EZxVJopXguB6Dggw0+F64f9wcCkrlJHF
|
|
||||||
KWb/O3oOt3zEicW6TcMPUMFCvkXTLIkL58WC4enqSM0XqgXUMrSkHaxg3WNkOLa3c/L2
|
|
||||||
y+j4VZysWxVc3FJ6KRf3Lwiy0xU8nMOX+g24wRBEz25X8GnQUChPgaU7IfDxqBSOIoJe
|
|
||||||
g+gw==
|
|
||||||
X-Gm-Message-State: ALoCoQl3V8lMkmm4Gts/aZ0Lu/5qryAOT350PDDAtbaQlpcj+zlPTZqCfsUP0zhbJUJ4JOScq02E
|
|
||||||
X-Received: by 10.140.47.137 with SMTP id m9mr7253559qga.95.1411549993693;
|
|
||||||
Wed, 24 Sep 2014 02:13:13 -0700 (PDT)
|
|
||||||
X-Forwarded-To: task@balt-nu.xs4all.nl
|
|
||||||
X-Forwarded-For: task@balt.nu task@balt-nu.xs4all.nl
|
|
||||||
Delivered-To: task@balt.nu
|
|
||||||
Received: by 10.140.19.48 with SMTP id 45csp501727qgg;
|
|
||||||
Wed, 24 Sep 2014 02:13:12 -0700 (PDT)
|
|
||||||
X-Received: by 10.180.20.43 with SMTP id k11mr30173626wie.38.1411549992151;
|
|
||||||
Wed, 24 Sep 2014 02:13:12 -0700 (PDT)
|
|
||||||
Received: from mail-wi0-x235.google.com (mail-wi0-x235.google.com [2a00:1450:400c:c05::235])
|
|
||||||
by mx.google.com with ESMTPS id dc10si12067203wjb.104.2014.09.24.02.13.11
|
|
||||||
for <task@balt.nu>
|
|
||||||
(version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
|
|
||||||
Wed, 24 Sep 2014 02:13:12 -0700 (PDT)
|
|
||||||
Received-SPF: pass (google.com: domain of lrbalt@gmail.com designates 2a00:1450:400c:c05::235 as permitted sender) client-ip=2a00:1450:400c:c05::235;
|
|
||||||
Authentication-Results: mx.google.com;
|
|
||||||
spf=pass (google.com: domain of lrbalt@gmail.com designates 2a00:1450:400c:c05::235 as permitted sender) smtp.mail=lrbalt@gmail.com;
|
|
||||||
dkim=pass header.i=@gmail.com;
|
|
||||||
dmarc=pass (p=NONE dis=NONE) header.from=gmail.com
|
|
||||||
Received: by mail-wi0-f181.google.com with SMTP id z2so6789450wiv.8
|
|
||||||
for <task@balt.nu>; Wed, 24 Sep 2014 02:13:11 -0700 (PDT)
|
|
||||||
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
|
|
||||||
d=gmail.com; s=20120113;
|
|
||||||
h=from:to:references:in-reply-to:subject:date:message-id:mime-version
|
|
||||||
:content-type:thread-index:content-language;
|
|
||||||
bh=nWJv3oQMsXP4/5/l+eXcFEElvo9gGf/EHfJDdpLbUTc=;
|
|
||||||
b=FrUi4Bfq76YukPqYAxgemZKpC/b+t3JkmojuKzlxky5w0OJcwfYx19XY5EGgxTpDWG
|
|
||||||
djgXZIt3B3Py9zw1ieSQmn67mntzsI8UudNMnkAZur4vHIFovUDQtIzr1PmRFqrSZr/E
|
|
||||||
BB4rpPZ8lhhO/MCxNj0q9ZWaphtMnCIik+GfR1JTIqmoTxdR/7O4B/S67yXuT6IXiBez
|
|
||||||
pL+Abe59jlwR6nahx13do9HjLGpyrKoojPQbTAaQpyxYdA+wy48L7txWJBS5KB6A9X/5
|
|
||||||
K4a+Slc6OJ+Z19g0NfjmUg2C9pUepLA/JcGImJJ7GAoiKkKeIOz5ba7vGOrY7eq+6Juo
|
|
||||||
VprA==
|
|
||||||
X-Received: by 10.194.201.201 with SMTP id kc9mr6601023wjc.50.1411549991779;
|
|
||||||
Wed, 24 Sep 2014 02:13:11 -0700 (PDT)
|
|
||||||
Received: from BaltAdviesASUS (balt-oud.xs4all.nl. [83.160.43.157])
|
|
||||||
by mx.google.com with ESMTPSA id u8sm5044998wia.24.2014.09.24.02.13.10
|
|
||||||
for <task@balt.nu>
|
|
||||||
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
|
|
||||||
Wed, 24 Sep 2014 02:13:10 -0700 (PDT)
|
|
||||||
From: 5555555555@tmomail.net
|
|
||||||
To: 5555555555@tmomail.net
|
|
||||||
References: <fd565d3d-e03b-4382-95f3-843755956335@MAS2103.INFRA.LOCAL>
|
|
||||||
In-Reply-To: <fd565d3d-e03b-4382-95f3-843755956335@MAS2103.INFRA.LOCAL>
|
|
||||||
Subject: FW: Ingediende nota('s)
|
|
||||||
Date: Wed, 24 Sep 2014 11:13:10 +0200
|
|
||||||
Message-ID: <001d01cfd7d7$c383a9c0$4a8afd40$@gmail.com>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: multipart/mixed;
|
|
||||||
boundary="----=_NextPart_000_0022_01CFD7E8.870D8B30"
|
|
||||||
X-Mailer: Microsoft Outlook 15.0
|
|
||||||
Thread-Index: AQHegIh7i1l3Ugf25nxZMiNc2taHEJvyrmxQ
|
|
||||||
Content-Language: nl
|
|
||||||
|
|
||||||
This is a multipart message in MIME format.
|
|
||||||
|
|
||||||
------=_NextPart_000_0022_01CFD7E8.870D8B30
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="us-ascii"
|
|
||||||
Content-Transfer-Encoding: 7bit
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------=_NextPart_000_0022_01CFD7E8.870D8B30
|
|
||||||
Content-Type: message/rfc822
|
|
||||||
Content-Transfer-Encoding: 7bit
|
|
||||||
Content-Disposition: attachment
|
|
||||||
|
|
||||||
Received: by 10.220.39.70 with SMTP id f6csp395476vce;
|
|
||||||
Tue, 23 Sep 2014 04:02:06 -0700 (PDT)
|
|
||||||
Received: from mailnode3.cz.nl (mailnode3.cz.nl. [194.151.60.3])
|
|
||||||
by mx.google.com with ESMTPS id v19si1882645wij.81.2014.09.23.04.02.04
|
|
||||||
for <lrbalt@gmail.com>
|
|
||||||
(version=TLSv1 cipher=RC4-SHA bits=128/128);
|
|
||||||
Tue, 23 Sep 2014 04:02:04 -0700 (PDT)
|
|
||||||
Return-Path: <_noreply@ohra-zorg.nl>
|
|
||||||
From: <_noreply@ohra-zorg.nl>
|
|
||||||
To: <lrbalt@gmail.com>
|
|
||||||
Subject: Ingediende nota('s)
|
|
||||||
Date: Tue, 23 Sep 2014 13:02:21 +0200
|
|
||||||
Message-ID: <fd565d3d-e03b-4382-95f3-843755956335@MAS2103.INFRA.LOCAL>
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: multipart/alternative;
|
|
||||||
boundary="----=_NextPart_000_001E_01CFD7E8.870D6420"
|
|
||||||
X-Mailer: Microsoft Outlook 15.0
|
|
||||||
Thread-Index: AQHegIh7i1l3Ugf25nxZMiNc2taHEA==
|
|
||||||
|
|
||||||
This is a multipart message in MIME format.
|
|
||||||
|
|
||||||
------=_NextPart_000_001E_01CFD7E8.870D6420
|
|
||||||
Content-Type: text/plain;
|
|
||||||
charset="utf-8"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
Geachte heer Balt,
|
|
||||||
|
|
||||||
U heeft op 23 september 2014 onderstaande declaratie ingediend.
|
|
||||||
|
|
||||||
Nota 1
|
|
||||||
Gedeclareerde nota's: jinte 20-8.pdf=09
|
|
||||||
Behandelde verzekerde: JM Balt (26-01-2006)=09
|
|
||||||
Naam zorgverlener: Solvejg Dunnewolt=09
|
|
||||||
Notabedrag: 60,00=09
|
|
||||||
Nota betalen aan: LR Balt=09
|
|
||||||
|
|
||||||
|
|
||||||
Aanvullende informatie bij uw nota's
|
|
||||||
|
|
||||||
Is er bij een of meerdere nota's sprake van een ongeval waarvoor een =
|
|
||||||
ander aansprakelijk gesteld kan worden? Nee=09
|
|
||||||
Heeft u bij een of meerdere nota's kosten gemaakt in het buitenland? Nee =
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Declaratieformulier
|
|
||||||
U declareert digitaal via Mijn OHRA Zorgverzekering. Daar kunt u ook een =
|
|
||||||
declaratieformulier downloaden en uitprinten.
|
|
||||||
U ontvangt geen papieren declaratieformulier meer per post.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Met vriendelijke groet,
|
|
||||||
|
|
||||||
OHRA
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_____________________________________________________________________
|
|
||||||
Dit e-mailbericht is vertrouwelijk en uitsluitend bestemd voor de =
|
|
||||||
geadresseerde.
|
|
||||||
Indien u niet de beoogde ontvanger van dit e-mailbericht bent, verzoeken =
|
|
||||||
wij u
|
|
||||||
vriendelijk om de verzender hiervan direct op de hoogte te stellen en om =
|
|
||||||
het
|
|
||||||
bericht van alle locaties in uw computer en netwerk te verwijderen.
|
|
||||||
Openbaarmaking, vermenigvuldiging, verstrekking aan en/of gebruik door =
|
|
||||||
derden
|
|
||||||
van dit e-mailbericht en/of deze informatie is niet toegestaan; indien =
|
|
||||||
dit gebeurt,
|
|
||||||
kan er sprake zijn van onrechtmatig handelen. E-mail is een informele =
|
|
||||||
manier van
|
|
||||||
communiceren en kan aan al dan niet opzettelijk verkeerd gebruik of =
|
|
||||||
misbruik van
|
|
||||||
gegevens worden blootgesteld. OHRA is niet in staat om de inhoud van de =
|
|
||||||
informatie
|
|
||||||
die via het internet wordt verstuurd te controleren en aanvaardt =
|
|
||||||
daarvoor geen
|
|
||||||
enkele aansprakelijkheid.
|
|
||||||
_____________________________________________________________________
|
|
||||||
|
|
||||||
|
|
||||||
------=_NextPart_000_001E_01CFD7E8.870D6420
|
|
||||||
Content-Type: text/html;
|
|
||||||
charset="utf-8"
|
|
||||||
Content-Transfer-Encoding: quoted-printable
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<style type=3D"text/css">
|
|
||||||
table,th,td
|
|
||||||
{font-family:"arial";font-size: 10pt;}
|
|
||||||
body
|
|
||||||
{font-family:"arial";font-size: 10pt;}
|
|
||||||
td
|
|
||||||
{font-family:"arial";font-size: 10pt;}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>Geachte heer Balt,<br /><br />U heeft op 23 september 2014 =
|
|
||||||
onderstaande declaratie ingediend.<br /><br /><strong>Nota =
|
|
||||||
1</strong><table><tbody><tr><td>Gedeclareerde nota's:</td><td>jinte =
|
|
||||||
20-8.pdf</td></tr><tr><td>Behandelde verzekerde:</td><td>JM Balt =
|
|
||||||
(26-01-2006)</td></tr><tr><td>Naam zorgverlener:</td><td>Solvejg =
|
|
||||||
Dunnewolt</td></tr><tr><td>Notabedrag:</td><td>60,00</td></tr><tr><td>Not=
|
|
||||||
a betalen aan:</td><td>LR Balt</td></tr></tbody></table><br /> <br =
|
|
||||||
/><b>Aanvullende informatie bij uw nota's</b><br /><table><tr><td>Is er =
|
|
||||||
bij een of meerdere nota's sprake van een ongeval waarvoor een ander =
|
|
||||||
aansprakelijk gesteld kan worden?</td><td>Nee</td></tr><tr><td>Heeft u =
|
|
||||||
bij een of meerdere nota's kosten gemaakt in het =
|
|
||||||
buitenland?</td><td>Nee</td></tr></table><br /><br =
|
|
||||||
/><strong>Declaratieformulier<br /></strong>U declareert digitaal via =
|
|
||||||
Mijn OHRA Zorgverzekering. Daar kunt u ook een declaratieformulier =
|
|
||||||
downloaden en uitprinten.<br />U ontvangt geen papieren =
|
|
||||||
declaratieformulier meer per post.<br /><br /><br /><br />Met =
|
|
||||||
vriendelijke groet,<br /><br />OHRA<br /><br /><br>
|
|
||||||
<P>_____________________________________________________________________<=
|
|
||||||
br>Dit e-mailbericht is vertrouwelijk en uitsluitend bestemd voor de =
|
|
||||||
geadresseerde.<br>Indien u niet de beoogde ontvanger van dit =
|
|
||||||
e-mailbericht bent, verzoeken wij u<br>vriendelijk om de verzender =
|
|
||||||
hiervan direct op de hoogte te stellen en om het<br>bericht van alle =
|
|
||||||
locaties in uw computer en netwerk te verwijderen.<br>Openbaarmaking, =
|
|
||||||
vermenigvuldiging, verstrekking aan en/of gebruik door derden<br>van dit =
|
|
||||||
e-mailbericht en/of deze informatie is niet toegestaan; indien dit =
|
|
||||||
gebeurt,<br>kan er sprake zijn van onrechtmatig handelen. E-mail is een =
|
|
||||||
informele manier van<br>communiceren en kan aan al dan niet opzettelijk =
|
|
||||||
verkeerd gebruik of misbruik van<br>gegevens worden blootgesteld. OHRA =
|
|
||||||
is niet in staat om de inhoud van de informatie<br>die via het internet =
|
|
||||||
wordt verstuurd te controleren en aanvaardt daarvoor geen<br>enkele =
|
|
||||||
aansprakelijkheid.<br>___________________________________________________=
|
|
||||||
__________________</P></body>
|
|
||||||
------=_NextPart_000_001E_01CFD7E8.870D6420--
|
|
||||||
|
|
||||||
------=_NextPart_000_0022_01CFD7E8.870D8B30--
|
|
||||||
|
|
||||||
|
|
@ -8,7 +8,7 @@ module RecurringTodos
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@admin = users(:admin_user)
|
@admin = users(:admin_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_pattern_builds_from_existing_recurring_todo
|
def test_pattern_builds_from_existing_recurring_todo
|
||||||
rt = @admin.recurring_todos.first
|
rt = @admin.recurring_todos.first
|
||||||
|
|
@ -121,9 +121,9 @@ module RecurringTodos
|
||||||
def test_determine_start
|
def test_determine_start
|
||||||
travel_to Time.zone.local(2013,1,1) do
|
travel_to Time.zone.local(2013,1,1) do
|
||||||
rt = create_recurring_todo
|
rt = create_recurring_todo
|
||||||
assert_equal "2013-01-01", rt.send(:determine_start, nil).to_date.to_s(:db), "no previous date, use today"
|
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil).to_s(:db), "no previous date, use today"
|
||||||
assert_equal "2013-01-01", rt.send(:determine_start, nil, 1.day).to_date.to_s(:db), "no previous date, use today without offset"
|
assert_equal "2013-01-01 00:00:00", rt.send(:determine_start, nil, 1.day).to_s(:db), "no previous date, use today without offset"
|
||||||
assert_equal "2013-01-02", rt.send(:determine_start, Time.zone.now, 1.day).to_date.to_s(:db), "use previous date and offset"
|
assert_equal "2013-01-02 00:00:00", rt.send(:determine_start, Time.zone.now, 1.day).to_s(:db), "use previous date and offset"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -131,14 +131,14 @@ module RecurringTodos
|
||||||
rt = create_recurring_todo
|
rt = create_recurring_todo
|
||||||
|
|
||||||
# march 2014 has 5 saturdays, the last will return the 5th
|
# march 2014 has 5 saturdays, the last will return the 5th
|
||||||
assert_equal "2014-03-01", rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-01 00:00:00", rt.send(:get_xth_day_of_month, 1, 6, 3, 2014).to_s(:db)
|
||||||
assert_equal "2014-03-22", rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-22 00:00:00", rt.send(:get_xth_day_of_month, 4, 6, 3, 2014).to_s(:db)
|
||||||
assert_equal "2014-03-29", rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-29 00:00:00", rt.send(:get_xth_day_of_month, 5, 6, 3, 2014).to_s(:db)
|
||||||
|
|
||||||
# march 2014 has 4 fridays, the last will return the 4th
|
# march 2014 has 4 fridays, the last will return the 4th
|
||||||
assert_equal "2014-03-07", rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-07 00:00:00", rt.send(:get_xth_day_of_month, 1, 5, 3, 2014).to_s(:db)
|
||||||
assert_equal "2014-03-28", rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-28 00:00:00", rt.send(:get_xth_day_of_month, 4, 5, 3, 2014).to_s(:db)
|
||||||
assert_equal "2014-03-28", rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_date.to_s(:db)
|
assert_equal "2014-03-28 00:00:00", rt.send(:get_xth_day_of_month, 5, 5, 3, 2014).to_s(:db)
|
||||||
|
|
||||||
assert_raise(RuntimeError, "should check on valid weekdays"){ rt.send(:get_xth_day_of_month, 5, 9, 3, 2014) }
|
assert_raise(RuntimeError, "should check on valid weekdays"){ rt.send(:get_xth_day_of_month, 5, 9, 3, 2014) }
|
||||||
assert_raise(RuntimeError, "should check on valid count x"){ rt.send(:get_xth_day_of_month, 6, 5, 3, 2014) }
|
assert_raise(RuntimeError, "should check on valid count x"){ rt.send(:get_xth_day_of_month, 6, 5, 3, 2014) }
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
assert_equal "Call Bill Gates to find out how much he makes per day", @not_completed1.description
|
assert_equal "Call Bill Gates to find out how much he makes per day", @not_completed1.description
|
||||||
assert_nil @not_completed1.notes
|
assert_nil @not_completed1.notes
|
||||||
assert @not_completed1.completed? == false
|
assert @not_completed1.completed? == false
|
||||||
assert_equal 1.week.ago.beginning_of_day.to_date.to_s, @not_completed1.created_at.localtime.beginning_of_day.to_date.to_s
|
assert_equal 1.week.ago.beginning_of_day.strftime("%Y-%m-%d %H:%M"), @not_completed1.created_at.beginning_of_day.strftime("%Y-%m-%d %H:%M")
|
||||||
assert_equal 2.week.from_now.beginning_of_day.to_date.to_s, @not_completed1.due.localtime.to_date.to_s
|
assert_equal 2.week.from_now.beginning_of_day.strftime("%Y-%m-%d"), @not_completed1.due.strftime("%Y-%m-%d")
|
||||||
assert_nil @not_completed1.completed_at
|
assert_nil @not_completed1.completed_at
|
||||||
assert_equal 1, @not_completed1.user_id
|
assert_equal 1, @not_completed1.user_id
|
||||||
end
|
end
|
||||||
|
|
@ -72,26 +72,26 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
def test_validate_show_from_must_be_a_date_in_the_future
|
def test_validate_show_from_must_be_a_date_in_the_future
|
||||||
t = @not_completed2
|
t = @not_completed2
|
||||||
t.show_from = 1.week.ago
|
t.show_from = 1.week.ago
|
||||||
|
|
||||||
assert !t.save, "todo should not be saved without validation errors"
|
assert !t.save, "todo should not be saved without validation errors"
|
||||||
assert_equal 1, t.errors.count
|
assert_equal 1, t.errors.count
|
||||||
assert_equal "must be a date in the future", t.errors[:show_from][0]
|
assert_equal "must be a date in the future", t.errors[:show_from][0]
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_validate_circular_dependencies
|
def test_validate_circular_dependencies
|
||||||
@completed.activate!
|
@completed.activate!
|
||||||
@not_completed3=@completed
|
@not_completed3=@completed
|
||||||
|
|
||||||
# 2 -> 1
|
# 2 -> 1
|
||||||
@not_completed1.add_predecessor(@not_completed2)
|
@not_completed1.add_predecessor(@not_completed2)
|
||||||
assert @not_completed1.save!
|
assert @not_completed1.save!
|
||||||
assert_equal 1, @not_completed2.successors.count
|
assert_equal 1, @not_completed2.successors.count
|
||||||
|
|
||||||
# 3 -> 2 -> 1
|
# 3 -> 2 -> 1
|
||||||
@not_completed2.add_predecessor(@not_completed3)
|
@not_completed2.add_predecessor(@not_completed3)
|
||||||
assert @not_completed2.save!
|
assert @not_completed2.save!
|
||||||
assert_equal 1, @not_completed3.successors.count
|
assert_equal 1, @not_completed3.successors.count
|
||||||
|
|
||||||
# 1 -> 3 -> 2 -> 1 == circle
|
# 1 -> 3 -> 2 -> 1 == circle
|
||||||
assert_raises ActiveRecord::RecordInvalid do
|
assert_raises ActiveRecord::RecordInvalid do
|
||||||
@not_completed3.add_predecessor(@not_completed1)
|
@not_completed3.add_predecessor(@not_completed1)
|
||||||
|
|
@ -131,7 +131,7 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
t.toggle_completion!
|
t.toggle_completion!
|
||||||
assert_equal :active, t.aasm.current_state
|
assert_equal :active, t.aasm.current_state
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_toggle_completion_with_show_from_in_future
|
def test_toggle_completion_with_show_from_in_future
|
||||||
t = @not_completed1
|
t = @not_completed1
|
||||||
t.show_from= 1.week.from_now
|
t.show_from= 1.week.from_now
|
||||||
|
|
@ -140,12 +140,12 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
t.toggle_completion!
|
t.toggle_completion!
|
||||||
assert_equal :completed, t.aasm.current_state
|
assert_equal :completed, t.aasm.current_state
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_toggle_completion_with_show_from_in_past
|
def test_toggle_completion_with_show_from_in_past
|
||||||
t = @not_completed1
|
t = @not_completed1
|
||||||
t.update_attribute(:show_from, 1.week.ago)
|
t.update_attribute(:show_from, 1.week.ago)
|
||||||
assert_equal :active, t.aasm.current_state
|
assert_equal :active, t.aasm.current_state
|
||||||
|
|
||||||
assert t.toggle_completion!, "shoud be able to mark active todo complete even if show_from is set in the past"
|
assert t.toggle_completion!, "shoud be able to mark active todo complete even if show_from is set in the past"
|
||||||
assert_equal :completed, t.aasm.current_state
|
assert_equal :completed, t.aasm.current_state
|
||||||
end
|
end
|
||||||
|
|
@ -219,7 +219,7 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
# And I update the state of the todo from its project
|
# And I update the state of the todo from its project
|
||||||
new_todo.update_state_from_project
|
new_todo.update_state_from_project
|
||||||
# Then the todo should be hidden
|
# Then the todo should be hidden
|
||||||
assert new_todo.hidden?
|
assert new_todo.hidden?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_initial_state_defaults_to_active
|
def test_initial_state_defaults_to_active
|
||||||
|
|
@ -280,7 +280,7 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
assert todo.pending?, "todo with predecessor should be blocked"
|
assert todo.pending?, "todo with predecessor should be blocked"
|
||||||
|
|
||||||
# cannot activate if part of hidden project
|
# cannot activate if part of hidden project
|
||||||
assert_raise(AASM::InvalidTransition) { todo.activate! }
|
assert_raise(AASM::InvalidTransition) { todo.activate! }
|
||||||
|
|
||||||
todo.remove_predecessor(todo2)
|
todo.remove_predecessor(todo2)
|
||||||
assert todo.reload.hidden?, "todo should be put back in hidden state"
|
assert todo.reload.hidden?, "todo should be put back in hidden state"
|
||||||
|
|
@ -337,7 +337,7 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
@not_completed1.add_predecessor(@not_completed2)
|
@not_completed1.add_predecessor(@not_completed2)
|
||||||
@not_completed1.save_predecessors
|
@not_completed1.save_predecessors
|
||||||
# blocking is not done automagically
|
# blocking is not done automagically
|
||||||
@not_completed1.block!
|
@not_completed1.block!
|
||||||
|
|
||||||
assert @not_completed1.uncompleted_predecessors?
|
assert @not_completed1.uncompleted_predecessors?
|
||||||
assert @not_completed1.pending?, "a todo with predecessors should be pending"
|
assert @not_completed1.pending?, "a todo with predecessors should be pending"
|
||||||
|
|
@ -358,7 +358,7 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
@not_completed1.add_predecessor_list("#{@not_completed2.id}, #{@not_completed3.id}")
|
@not_completed1.add_predecessor_list("#{@not_completed2.id}, #{@not_completed3.id}")
|
||||||
@not_completed1.save_predecessors
|
@not_completed1.save_predecessors
|
||||||
# blocking is not done automagically
|
# blocking is not done automagically
|
||||||
@not_completed1.block!
|
@not_completed1.block!
|
||||||
|
|
||||||
# Then @completed1 should have predecessors and should be blocked
|
# Then @completed1 should have predecessors and should be blocked
|
||||||
assert @not_completed1.uncompleted_predecessors?
|
assert @not_completed1.uncompleted_predecessors?
|
||||||
|
|
@ -526,18 +526,18 @@ class TodoTest < ActiveSupport::TestCase
|
||||||
assert !older_created_todos.include?(todo_now)
|
assert !older_created_todos.include?(todo_now)
|
||||||
assert !recent_created_todos.include?(todo_old)
|
assert !recent_created_todos.include?(todo_old)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_notes_are_rendered_on_save
|
def test_notes_are_rendered_on_save
|
||||||
user = @completed.user
|
user = @completed.user
|
||||||
todo = user.todos.create(:description => "test", :context => @completed.context)
|
todo = user.todos.create(:description => "test", :context => @completed.context)
|
||||||
|
|
||||||
assert_nil todo.notes
|
assert_nil todo.notes
|
||||||
assert_nil todo.rendered_notes
|
assert_nil todo.rendered_notes
|
||||||
|
|
||||||
todo.notes = "*test*"
|
todo.notes = "*test*"
|
||||||
todo.save!
|
todo.save!
|
||||||
todo.reload
|
todo.reload
|
||||||
|
|
||||||
assert_equal "*test*", todo.notes
|
assert_equal "*test*", todo.notes
|
||||||
assert_equal "<p><strong>test</strong></p>", todo.rendered_notes
|
assert_equal "<p><strong>test</strong></p>", todo.rendered_notes
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue