mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-26 12:08:47 +01:00
fix failing tests
This commit is contained in:
parent
9c0445fcb7
commit
67247980ad
2 changed files with 51 additions and 47 deletions
|
|
@ -318,7 +318,7 @@ class TodosController < ApplicationController
|
|||
@predecessors = @predecessor.predecessors
|
||||
@successor = @todo
|
||||
@removed = @successor.remove_predecessor(@predecessor)
|
||||
determine_remaining_in_context_count
|
||||
determine_remaining_in_container_count(@todo)
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
|
|
@ -425,6 +425,7 @@ class TodosController < ApplicationController
|
|||
# change context if you drag a todo to another context
|
||||
@todo = current_user.todos.find(params[:id])
|
||||
@original_item_context_id = @todo.context_id
|
||||
@original_item = current_user.todos.build(@todo.attributes) # create a (unsaved) copy of the original todo
|
||||
@context = current_user.contexts.find(params[:todo][:context_id])
|
||||
@todo.context = @context
|
||||
@saved = @todo.save
|
||||
|
|
@ -432,7 +433,7 @@ class TodosController < ApplicationController
|
|||
@context_changed = true
|
||||
@status_message = t('todos.context_changed', :name => @context.name)
|
||||
determine_down_count
|
||||
determine_remaining_in_context_count(@original_item_context_id)
|
||||
determine_remaining_in_container_count(@original_item)
|
||||
|
||||
respond_to do |format|
|
||||
format.js { render :action => :update }
|
||||
|
|
|
|||
|
|
@ -126,56 +126,59 @@ class RecurringTodosControllerTest < ActionController::TestCase
|
|||
# this test is a duplicate of the unit test. Only this test covers the
|
||||
# codepath in the controllers
|
||||
|
||||
login_as(:admin_user)
|
||||
Timecop.travel(Time.local(2012,1,1)) do
|
||||
|
||||
orig_rt_count = RecurringTodo.count
|
||||
orig_todo_count = Todo.count
|
||||
login_as(:admin_user)
|
||||
|
||||
put :create,
|
||||
"context_name"=>"library",
|
||||
"project_name"=>"Build a working time machine",
|
||||
"recurring_todo" =>
|
||||
{
|
||||
"daily_every_x_days"=>"1",
|
||||
"daily_selector"=>"daily_every_x_day",
|
||||
"description"=>"new recurring pattern",
|
||||
"end_date" => "",
|
||||
"ends_on" => "no_end_date",
|
||||
"monthly_day_of_week" => "1",
|
||||
"monthly_every_x_day" => "22",
|
||||
"monthly_every_x_month2" => "1",
|
||||
"monthly_every_x_month" => "1",
|
||||
"monthly_every_xth_day"=>"1",
|
||||
"monthly_selector"=>"monthly_every_x_day",
|
||||
"notes"=>"with some notes",
|
||||
"number_of_occurences" => "",
|
||||
"recurring_period"=>"yearly",
|
||||
"recurring_show_days_before"=>"0",
|
||||
"recurring_target"=>"due_date",
|
||||
"recurring_show_always" => "1",
|
||||
"start_from"=>"1/10/2012", # adjust after 2012
|
||||
"weekly_every_x_week"=>"1",
|
||||
"weekly_return_monday"=>"w",
|
||||
"yearly_day_of_week"=>"0",
|
||||
"yearly_every_x_day"=>"22",
|
||||
"yearly_every_xth_day"=>"5",
|
||||
"yearly_month_of_year2"=>"3",
|
||||
"yearly_month_of_year"=>"10",
|
||||
"yearly_selector"=>"yearly_every_xth_day"
|
||||
},
|
||||
"tag_list"=>"one, two, three, four"
|
||||
orig_rt_count = RecurringTodo.count
|
||||
orig_todo_count = Todo.count
|
||||
|
||||
# check new recurring todo added
|
||||
assert_equal orig_rt_count+1, RecurringTodo.count
|
||||
# check new todo added
|
||||
assert_equal orig_todo_count+1, Todo.count
|
||||
put :create,
|
||||
"context_name"=>"library",
|
||||
"project_name"=>"Build a working time machine",
|
||||
"recurring_todo" =>
|
||||
{
|
||||
"daily_every_x_days"=>"1",
|
||||
"daily_selector"=>"daily_every_x_day",
|
||||
"description"=>"new recurring pattern",
|
||||
"end_date" => "",
|
||||
"ends_on" => "no_end_date",
|
||||
"monthly_day_of_week" => "1",
|
||||
"monthly_every_x_day" => "22",
|
||||
"monthly_every_x_month2" => "1",
|
||||
"monthly_every_x_month" => "1",
|
||||
"monthly_every_xth_day"=>"1",
|
||||
"monthly_selector"=>"monthly_every_x_day",
|
||||
"notes"=>"with some notes",
|
||||
"number_of_occurences" => "",
|
||||
"recurring_period"=>"yearly",
|
||||
"recurring_show_days_before"=>"0",
|
||||
"recurring_target"=>"due_date",
|
||||
"recurring_show_always" => "1",
|
||||
"start_from"=>"1/10/2012", # adjust after 2012
|
||||
"weekly_every_x_week"=>"1",
|
||||
"weekly_return_monday"=>"w",
|
||||
"yearly_day_of_week"=>"0",
|
||||
"yearly_every_x_day"=>"22",
|
||||
"yearly_every_xth_day"=>"5",
|
||||
"yearly_month_of_year2"=>"3",
|
||||
"yearly_month_of_year"=>"10",
|
||||
"yearly_selector"=>"yearly_every_xth_day"
|
||||
},
|
||||
"tag_list"=>"one, two, three, four"
|
||||
|
||||
# find the newly created todo
|
||||
new_todo = Todo.where(:description => "new recurring pattern").first
|
||||
assert !new_todo.nil?
|
||||
# check new recurring todo added
|
||||
assert_equal orig_rt_count+1, RecurringTodo.count
|
||||
# check new todo added
|
||||
assert_equal orig_todo_count+1, Todo.count
|
||||
|
||||
# the date should be 31 march 2013
|
||||
assert_equal Time.zone.local(2013,3,31), new_todo.due
|
||||
# find the newly created todo
|
||||
new_todo = Todo.where(:description => "new recurring pattern").first
|
||||
assert !new_todo.nil?
|
||||
|
||||
# the date should be 31 march 2013
|
||||
assert_equal Time.zone.local(2013,3,31), new_todo.due
|
||||
end
|
||||
end
|
||||
|
||||
def test_recurring_todo_with_due_date_and_show_always
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue