update gems and fix i18n and aasm deprecation warnings

This commit is contained in:
Reinier Balt 2013-12-30 20:52:35 +01:00
parent b1c306b09e
commit 17dca39d3a
10 changed files with 113 additions and 104 deletions

View file

@ -48,7 +48,7 @@ class ProjectsControllerTest < ActionController::TestCase
login_as(:admin_user)
xhr :post, :update, :id => 1, "project"=>{"name"=>p.name, "description"=>p.description, "state"=>"hidden"}
todos.each do |t|
assert_equal :project_hidden, t.reload().aasm_current_state
assert_equal :project_hidden, t.reload().aasm.current_state
end
assert p.reload().hidden?
end
@ -60,7 +60,7 @@ class ProjectsControllerTest < ActionController::TestCase
xhr :post, :update, :id => 1, "project"=>{"name"=>p.name, "description"=>p.description, "state"=>"hidden"}
xhr :post, :update, :id => 1, "project"=>{"name"=>p.name, "description"=>p.description, "state"=>"active"}
todos.each do |t|
assert_equal :active, t.reload().aasm_current_state
assert_equal :active, t.reload().aasm.current_state
end
assert p.reload().active?
end

View file

@ -84,7 +84,7 @@ class RecurringTodosControllerTest < ActionController::TestCase
xhr :post, :toggle_check, :id=>1, :_source_view=>""
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}"
# by making active, a new todo should be created from the pattern
assert_equal todo_count+1, Todo.count

View file

@ -48,36 +48,36 @@ class ProjectTest < ActiveSupport::TestCase
# state machine
def test_project_initial_state_is_active
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
assert @timemachine.active?
end
def test_hide_project
@timemachine.hide!
assert_equal :hidden, @timemachine.aasm_current_state
assert_equal :hidden, @timemachine.aasm.current_state
assert @timemachine.hidden?
end
def test_activate_project
@timemachine.activate!
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
assert @timemachine.active?
end
def test_transition_to_another_state
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
@timemachine.transition_to(:hidden)
assert_equal :hidden, @timemachine.aasm_current_state
assert_equal :hidden, @timemachine.aasm.current_state
@timemachine.transition_to(:completed)
assert_equal :completed, @timemachine.aasm_current_state
assert_equal :completed, @timemachine.aasm.current_state
@timemachine.transition_to(:active)
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
end
def test_transition_to_same_state
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
@timemachine.transition_to(:active)
assert_equal :active, @timemachine.aasm_current_state
assert_equal :active, @timemachine.aasm.current_state
end
# other tests
@ -95,7 +95,7 @@ class ProjectTest < ActiveSupport::TestCase
def test_complete_project
assert_nil @timemachine.completed_at
@timemachine.complete!
assert_equal :completed, @timemachine.aasm_current_state
assert_equal :completed, @timemachine.aasm.current_state
assert @timemachine.completed?
assert_not_nil @timemachine.completed_at, "completed_at not expected to be nil"
assert_in_delta Time.now, @timemachine.completed_at, 1
@ -150,7 +150,7 @@ class ProjectTest < ActiveSupport::TestCase
first_todo = @moremoney.todos[0]
first_todo.show_from = Time.zone.now + 1.week
first_todo.save!
assert_equal :deferred, @moremoney.todos[0].aasm_current_state
assert_equal :deferred, @moremoney.todos[0].aasm.current_state
assert_equal 1, @moremoney.todos.deferred.count
end

View file

@ -97,10 +97,10 @@ class TodoTest < ActiveSupport::TestCase
def test_defer_an_existing_todo
@not_completed2
assert_equal :active, @not_completed2.aasm_current_state
assert_equal :active, @not_completed2.aasm.current_state
@not_completed2.show_from = Time.zone.now + 1.week
assert @not_completed2.save, "should have saved successfully" + @not_completed2.errors.to_xml
assert_equal :deferred, @not_completed2.aasm_current_state
assert_equal :deferred, @not_completed2.aasm.current_state
end
def test_create_a_new_deferred_todo
@ -110,41 +110,41 @@ class TodoTest < ActiveSupport::TestCase
todo.context_id = 1
todo.description = 'foo'
assert todo.save, "should have saved successfully" + todo.errors.to_xml
assert_equal :deferred, todo.aasm_current_state
assert_equal :deferred, todo.aasm.current_state
end
def test_create_a_new_deferred_todo_by_passing_attributes
user = users(:other_user)
todo = user.todos.build(:show_from => next_week, :context_id => 1, :description => 'foo')
assert todo.save, "should have saved successfully" + todo.errors.to_xml
assert_equal :deferred, todo.aasm_current_state
assert_equal :deferred, todo.aasm.current_state
end
def test_toggle_completion
t = @not_completed1
assert_equal :active, t.aasm_current_state
assert_equal :active, t.aasm.current_state
t.toggle_completion!
assert_equal :completed, t.aasm_current_state
assert_equal :completed, t.aasm.current_state
t.toggle_completion!
assert_equal :active, t.aasm_current_state
assert_equal :active, t.aasm.current_state
end
def test_toggle_completion_with_show_from_in_future
t = @not_completed1
t.show_from= 1.week.from_now
t.save!
assert_equal :deferred, t.aasm_current_state
assert_equal :deferred, t.aasm.current_state
t.toggle_completion!
assert_equal :completed, t.aasm_current_state
assert_equal :completed, t.aasm.current_state
end
def test_toggle_completion_with_show_from_in_past
t = @not_completed1
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_equal :completed, t.aasm_current_state
assert_equal :completed, t.aasm.current_state
end
def test_activate_also_saves
@ -225,7 +225,7 @@ class TodoTest < ActiveSupport::TestCase
t.context_id = 1
t.save!
t.reload
assert_equal :active, t.aasm_current_state
assert_equal :active, t.aasm.current_state
end
def test_initial_state_is_deferred_when_show_from_in_future
@ -236,7 +236,7 @@ class TodoTest < ActiveSupport::TestCase
t.show_from = 1.week.from_now.to_date
t.save!
t.reload
assert_equal :deferred, t.aasm_current_state
assert_equal :deferred, t.aasm.current_state
end
def test_todo_is_not_starred