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

@ -1,6 +1,6 @@
GIT GIT
remote: https://github.com/cucumber/aruba remote: https://github.com/cucumber/aruba
revision: adbfc240d69254d7b525876b4c5bff6b721b7d65 revision: 7afbc5c0cbae9c9a946d70c4c2735ccb86e00f08
specs: specs:
aruba (0.5.3) aruba (0.5.3)
childprocess (>= 0.3.6) childprocess (>= 0.3.6)
@ -9,35 +9,35 @@ GIT
GIT GIT
remote: https://github.com/rails/actionpack-xml_parser remote: https://github.com/rails/actionpack-xml_parser
revision: 246653ab3670f329176c1e77e6cd1a632466f06e revision: e1516064761ea26502cd79b283f6af0fa2b1edf5
specs: specs:
actionpack-xml_parser (1.0.0) actionpack-xml_parser (1.0.1)
actionpack (>= 4.0.0.rc1, < 4.1) actionpack (>= 4.0.0, < 5)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
RedCloth (4.2.9) RedCloth (4.2.9)
aasm (3.0.22) aasm (3.0.25)
actionmailer (4.0.0) actionmailer (4.0.2)
actionpack (= 4.0.0) actionpack (= 4.0.2)
mail (~> 2.5.3) mail (~> 2.5.4)
actionpack (4.0.0) actionpack (4.0.2)
activesupport (= 4.0.0) activesupport (= 4.0.2)
builder (~> 3.1.0) builder (~> 3.1.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rack (~> 1.5.2) rack (~> 1.5.2)
rack-test (~> 0.6.2) rack-test (~> 0.6.2)
activemodel (4.0.0) activemodel (4.0.2)
activesupport (= 4.0.0) activesupport (= 4.0.2)
builder (~> 3.1.0) builder (~> 3.1.0)
activerecord (4.0.0) activerecord (4.0.2)
activemodel (= 4.0.0) activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2) activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.0) activesupport (= 4.0.2)
arel (~> 4.0.0) arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3) activerecord-deprecated_finders (1.0.3)
activesupport (4.0.0) activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4) i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2) minitest (~> 4.2)
multi_json (~> 1.3) multi_json (~> 1.3)
@ -45,16 +45,17 @@ GEM
tzinfo (~> 0.3.37) tzinfo (~> 0.3.37)
acts_as_list (0.3.0) acts_as_list (0.3.0)
activerecord (>= 3.0) activerecord (>= 3.0)
arel (4.0.0) arel (4.0.1)
atomic (1.1.14) atomic (1.1.14)
bcrypt-ruby (3.0.1) bcrypt-ruby (3.0.1)
builder (3.1.4) builder (3.1.4)
bullet (4.6.0) bullet (4.7.1)
uniform_notifier activesupport
uniform_notifier (>= 1.4.0)
cache_digests (0.3.1) cache_digests (0.3.1)
actionpack (>= 3.2) actionpack (>= 3.2)
thread_safe thread_safe
capybara (2.1.0) capybara (2.2.0)
mime-types (>= 1.16) mime-types (>= 1.16)
nokogiri (>= 1.3.3) nokogiri (>= 1.3.3)
rack (>= 1.0.0) rack (>= 1.0.0)
@ -62,19 +63,19 @@ GEM
xpath (~> 2.0) xpath (~> 2.0)
childprocess (0.3.9) childprocess (0.3.9)
ffi (~> 1.0, >= 1.0.11) ffi (~> 1.0, >= 1.0.11)
codeclimate-test-reporter (0.1.1) codeclimate-test-reporter (0.2.0)
simplecov (>= 0.7.1, < 1.0.0) simplecov (>= 0.7.1, < 1.0.0)
coffee-rails (4.0.0) coffee-rails (4.0.1)
coffee-script (>= 2.2.0) coffee-script (>= 2.2.0)
railties (>= 4.0.0.beta, < 5.0) railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0) coffee-script (2.2.0)
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.6.3) coffee-script-source (1.6.3)
cucumber (1.3.8) cucumber (1.3.10)
builder (>= 2.1.2) builder (>= 2.1.2)
diff-lcs (>= 1.1.3) diff-lcs (>= 1.1.3)
gherkin (~> 2.12.1) gherkin (~> 2.12)
multi_json (>= 1.7.5, < 2.0) multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.0.2) multi_test (>= 0.0.2)
cucumber-rails (1.4.0) cucumber-rails (1.4.0)
@ -82,89 +83,93 @@ GEM
cucumber (>= 1.2.0) cucumber (>= 1.2.0)
nokogiri (>= 1.5.0) nokogiri (>= 1.5.0)
rails (>= 3.0.0) rails (>= 3.0.0)
database_cleaner (1.1.1) database_cleaner (1.2.0)
diff-lcs (1.2.4) diff-lcs (1.2.5)
docile (1.1.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.0.1) execjs (2.0.2)
factory_girl (4.2.0) factory_girl (4.3.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
factory_girl_rails (4.2.1) factory_girl_rails (4.3.0)
factory_girl (~> 4.2.0) factory_girl (~> 4.3.0)
railties (>= 3.0.0) railties (>= 3.0.0)
ffi (1.9.0) ffi (1.9.3)
gherkin (2.12.1) gherkin (2.12.2)
multi_json (~> 1.3) multi_json (~> 1.3)
hike (1.2.3) hike (1.2.3)
htmlentities (4.3.1) htmlentities (4.3.1)
i18n (0.6.5) i18n (0.6.9)
jquery-rails (3.0.4) jquery-rails (3.0.4)
railties (>= 3.0, < 5.0) railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0) thor (>= 0.14, < 2.0)
json (1.8.0) json (1.8.1)
libv8 (3.16.14.3) libv8 (3.16.14.3)
mail (2.5.4) mail (2.5.4)
mime-types (~> 1.16) mime-types (~> 1.16)
treetop (~> 1.4.8) treetop (~> 1.4.8)
metaclass (0.0.1) metaclass (0.0.1)
mime-types (1.25) mime-types (1.25.1)
mini_portile (0.5.1) mini_portile (0.5.2)
minitest (4.7.5) minitest (4.7.5)
mocha (0.14.0) mocha (0.14.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
multi_json (1.8.0) multi_json (1.8.2)
multi_test (0.0.2) multi_test (0.0.2)
mysql2 (0.3.13) mysql2 (0.3.14)
nokogiri (1.6.0) nokogiri (1.6.1)
mini_portile (~> 0.5.0) mini_portile (~> 0.5.0)
polyglot (0.3.3) polyglot (0.3.3)
protected_attributes (1.0.5)
activemodel (>= 4.0.1, < 5.0)
rack (1.5.2) rack (1.5.2)
rack-mini-profiler (0.1.31) rack-mini-profiler (0.1.31)
rack (>= 1.1.3) rack (>= 1.1.3)
rack-test (0.6.2) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rails (4.0.0) rails (4.0.2)
actionmailer (= 4.0.0) actionmailer (= 4.0.2)
actionpack (= 4.0.0) actionpack (= 4.0.2)
activerecord (= 4.0.0) activerecord (= 4.0.2)
activesupport (= 4.0.0) activesupport (= 4.0.2)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.0.0) railties (= 4.0.2)
sprockets-rails (~> 2.0.0) sprockets-rails (~> 2.0.0)
rails_autolink (1.1.4) rails_autolink (1.1.5)
rails (> 3.1) rails (> 3.1)
railties (4.0.0) railties (4.0.2)
actionpack (= 4.0.0) actionpack (= 4.0.2)
activesupport (= 4.0.0) activesupport (= 4.0.2)
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rake (10.1.0) rake (10.1.1)
ref (1.0.5) ref (1.0.5)
rspec-expectations (2.14.3) rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0) diff-lcs (>= 1.1.3, < 2.0)
rubyzip (0.9.9) rubyzip (1.1.0)
safe_yaml (0.9.7) safe_yaml (0.9.7)
sanitize (2.0.6) sanitize (2.0.6)
nokogiri (>= 1.4.4) nokogiri (>= 1.4.4)
sass (3.2.10) sass (3.2.13)
sass-rails (4.0.0) sass-rails (4.0.1)
railties (>= 4.0.0.beta, < 5.0) railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10) sass (>= 3.1.10)
sprockets-rails (~> 2.0.0) sprockets-rails (~> 2.0.0)
selenium-webdriver (2.35.1) selenium-webdriver (2.39.0)
childprocess (>= 0.2.5) childprocess (>= 0.2.5)
multi_json (~> 1.0) multi_json (~> 1.0)
rubyzip (< 1.0.0) rubyzip (~> 1.0)
websocket (~> 1.0.4) websocket (~> 1.0.4)
simplecov (0.7.1) simplecov (0.8.2)
multi_json (~> 1.0) docile (~> 1.1.0)
simplecov-html (~> 0.7.1) multi_json
simplecov-html (0.7.1) simplecov-html (~> 0.8.0)
sprockets (2.10.0) simplecov-html (0.8.0)
sprockets (2.10.1)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0) multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.0) sprockets-rails (2.0.1)
actionpack (>= 3.0) actionpack (>= 3.0)
activesupport (>= 3.0) activesupport (>= 3.0)
sprockets (~> 2.8) sprockets (~> 2.8)
@ -180,22 +185,23 @@ GEM
atomic atomic
tilt (1.4.1) tilt (1.4.1)
timecop (0.6.3) timecop (0.6.3)
tolk (1.3.11) tolk (1.4.00)
protected_attributes
safe_yaml (~> 0.8) safe_yaml (~> 0.8)
will_paginate will_paginate
treetop (1.4.15) treetop (1.4.15)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
tzinfo (0.3.37) tzinfo (0.3.38)
uglifier (2.2.1) uglifier (2.4.0)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2) json (>= 1.8.0)
uniform_notifier (1.3.0) uniform_notifier (1.4.0)
websocket (1.0.7) websocket (1.0.7)
will_paginate (3.0.5) will_paginate (3.0.5)
xpath (2.0.0) xpath (2.0.0)
nokogiri (~> 1.3) nokogiri (~> 1.3)
yard (0.8.7.2) yard (0.8.7.3)
PLATFORMS PLATFORMS
ruby ruby

View file

@ -89,7 +89,7 @@ class Project < ActiveRecord::Base
# as a result of acts_as_state_machine calling state=() to update the attribute # as a result of acts_as_state_machine calling state=() to update the attribute
def transition_to(candidate_state) def transition_to(candidate_state)
case candidate_state.to_sym case candidate_state.to_sym
when aasm_current_state when aasm.current_state
return return
when :hidden when :hidden
hide! hide!

View file

@ -66,7 +66,7 @@ class Todo < ActiveRecord::Base
# state machine # state machine
include AASM include AASM
aasm_initial_state Proc.new { |t| (t.show_from && t.user && (t.show_from > t.user.date)) ? :deferred : :active} aasm_initial_state = Proc.new { |t| (t.show_from && t.user && (t.show_from > t.user.date)) ? :deferred : :active}
aasm :column => :state do aasm :column => :state do

View file

@ -28,4 +28,4 @@
<% else -%><%= render :partial => "notes/notes_summary", :collection => @project.notes %> <% else -%><%= render :partial => "notes/notes_summary", :collection => @project.notes %>
<% end -%> <% end -%>
<h2><%= t('projects.settings') %></h2> <h2><%= t('projects.settings') %></h2>
<%= t('projects.state', :state => project.aasm_current_state.to_s) %>. <%= @project_default_context %> <%= t('projects.state', :state => project.aasm.current_state.to_s) %>. <%= @project_default_context %>

View file

@ -1,11 +1,11 @@
# TODO: is this dead code? # TODO: is this dead code?
page.select('#project_status .active span').each do |element| page.select('#project_status .active span').each do |element|
element.className = @project.aasm_current_state == :active ? 'active_state' : 'inactive_state' element.className = @project.aasm.current_state == :active ? 'active_state' : 'inactive_state'
end end
page.select('#project_status .hidden span').each do |element| page.select('#project_status .hidden span').each do |element|
element.className = @project.aasm_current_state == :hidden ? 'active_state' : 'inactive_state' element.className = @project.aasm.current_state == :hidden ? 'active_state' : 'inactive_state'
end end
page.select('#project_status .completed span').each do |element| page.select('#project_status .completed span').each do |element|
element.className = @project.aasm_current_state == :completed ? 'active_state' : 'inactive_state' element.className = @project.aasm.current_state == :completed ? 'active_state' : 'inactive_state'
end end
page.notify :notice, "Set project status to #{@project.aasm_current_state}", 5.0 page.notify :notice, "Set project status to #{@project.aasm.current_state}", 5.0

View file

@ -68,5 +68,8 @@ module Tracksapp
config.action_view.sanitized_allowed_protocols = 'onenote', 'message' config.action_view.sanitized_allowed_protocols = 'onenote', 'message'
config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser config.middleware.insert_after ActionDispatch::ParamsParser, ActionDispatch::XmlParamsParser
# if a locale is invalid, the Rails app will raise an error
config.i18n.enforce_available_locales = true
end end
end end

View file

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

View file

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

View file

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

View file

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