mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-04 16:28:50 +01:00
update Gemset and fix deprecation warnings
This commit is contained in:
parent
b21697ed05
commit
13869edf8e
10 changed files with 123 additions and 119 deletions
127
Gemfile.lock
127
Gemfile.lock
|
|
@ -8,13 +8,13 @@ GEM
|
|||
remote: https://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
aasm (3.0.22)
|
||||
actionmailer (3.2.14)
|
||||
actionpack (= 3.2.14)
|
||||
aasm (3.0.25)
|
||||
actionmailer (3.2.16)
|
||||
actionpack (= 3.2.16)
|
||||
mail (~> 2.5.4)
|
||||
actionpack (3.2.14)
|
||||
activemodel (= 3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
actionpack (3.2.16)
|
||||
activemodel (= 3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
builder (~> 3.0.0)
|
||||
erubis (~> 2.7.0)
|
||||
journey (~> 1.0.4)
|
||||
|
|
@ -22,23 +22,23 @@ GEM
|
|||
rack-cache (~> 1.2)
|
||||
rack-test (~> 0.6.1)
|
||||
sprockets (~> 2.2.1)
|
||||
activemodel (3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
activemodel (3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
builder (~> 3.0.0)
|
||||
activerecord (3.2.14)
|
||||
activemodel (= 3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
activerecord (3.2.16)
|
||||
activemodel (= 3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
arel (~> 3.0.2)
|
||||
tzinfo (~> 0.3.29)
|
||||
activeresource (3.2.14)
|
||||
activemodel (= 3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
activesupport (3.2.14)
|
||||
activeresource (3.2.16)
|
||||
activemodel (= 3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
activesupport (3.2.16)
|
||||
i18n (~> 0.6, >= 0.6.4)
|
||||
multi_json (~> 1.0)
|
||||
acts_as_list (0.3.0)
|
||||
activerecord (>= 3.0)
|
||||
arel (3.0.2)
|
||||
arel (3.0.3)
|
||||
aruba (0.5.3)
|
||||
childprocess (>= 0.3.6)
|
||||
cucumber (>= 1.1.1)
|
||||
|
|
@ -46,9 +46,10 @@ GEM
|
|||
bcrypt-ruby (3.1.2)
|
||||
bluecloth (2.2.0)
|
||||
builder (3.0.4)
|
||||
bullet (4.6.0)
|
||||
uniform_notifier
|
||||
capybara (2.1.0)
|
||||
bullet (4.7.1)
|
||||
activesupport
|
||||
uniform_notifier (>= 1.4.0)
|
||||
capybara (2.2.0)
|
||||
mime-types (>= 1.16)
|
||||
nokogiri (>= 1.3.3)
|
||||
rack (>= 1.0.0)
|
||||
|
|
@ -63,11 +64,11 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.6.3)
|
||||
cucumber (1.3.6)
|
||||
cucumber (1.3.10)
|
||||
builder (>= 2.1.2)
|
||||
diff-lcs (>= 1.1.3)
|
||||
gherkin (~> 2.12.0)
|
||||
multi_json (~> 1.7.5)
|
||||
gherkin (~> 2.12)
|
||||
multi_json (>= 1.7.5, < 2.0)
|
||||
multi_test (>= 0.0.2)
|
||||
cucumber-rails (1.4.0)
|
||||
capybara (>= 1.1.2)
|
||||
|
|
@ -75,39 +76,40 @@ GEM
|
|||
nokogiri (>= 1.5.0)
|
||||
rails (>= 3.0.0)
|
||||
database_cleaner (0.9.1)
|
||||
diff-lcs (1.2.4)
|
||||
diff-lcs (1.2.5)
|
||||
docile (1.1.1)
|
||||
erubis (2.7.0)
|
||||
execjs (2.0.1)
|
||||
execjs (2.0.2)
|
||||
factory_girl (4.2.0)
|
||||
activesupport (>= 3.0.0)
|
||||
factory_girl_rails (4.2.1)
|
||||
factory_girl (~> 4.2.0)
|
||||
railties (>= 3.0.0)
|
||||
ffi (1.9.0)
|
||||
ffi (1.9.3)
|
||||
formatize (1.1.0)
|
||||
RedCloth (~> 4.2)
|
||||
actionpack (~> 3.0)
|
||||
bluecloth (~> 2.2)
|
||||
gherkin (2.12.1)
|
||||
gherkin (2.12.2)
|
||||
multi_json (~> 1.3)
|
||||
hike (1.2.3)
|
||||
htmlentities (4.3.1)
|
||||
i18n (0.6.5)
|
||||
i18n (0.6.9)
|
||||
journey (1.0.4)
|
||||
jquery-rails (2.3.0)
|
||||
railties (>= 3.0, < 5.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (1.8.0)
|
||||
json (1.8.1)
|
||||
libv8 (3.16.14.3)
|
||||
mail (2.5.4)
|
||||
mime-types (~> 1.16)
|
||||
treetop (~> 1.4.8)
|
||||
mime-types (1.25)
|
||||
mini_portile (0.5.1)
|
||||
multi_json (1.7.9)
|
||||
multi_test (0.0.2)
|
||||
mysql2 (0.3.13)
|
||||
nokogiri (1.6.0)
|
||||
mime-types (1.25.1)
|
||||
mini_portile (0.5.2)
|
||||
multi_json (1.8.2)
|
||||
multi_test (0.0.3)
|
||||
mysql2 (0.3.14)
|
||||
nokogiri (1.6.1)
|
||||
mini_portile (~> 0.5.0)
|
||||
polyglot (0.3.3)
|
||||
rack (1.4.5)
|
||||
|
|
@ -119,47 +121,48 @@ GEM
|
|||
rack
|
||||
rack-test (0.6.2)
|
||||
rack (>= 1.0)
|
||||
rails (3.2.14)
|
||||
actionmailer (= 3.2.14)
|
||||
actionpack (= 3.2.14)
|
||||
activerecord (= 3.2.14)
|
||||
activeresource (= 3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
rails (3.2.16)
|
||||
actionmailer (= 3.2.16)
|
||||
actionpack (= 3.2.16)
|
||||
activerecord (= 3.2.16)
|
||||
activeresource (= 3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
bundler (~> 1.0)
|
||||
railties (= 3.2.14)
|
||||
rails_autolink (1.1.0)
|
||||
railties (= 3.2.16)
|
||||
rails_autolink (1.1.5)
|
||||
rails (> 3.1)
|
||||
railties (3.2.14)
|
||||
actionpack (= 3.2.14)
|
||||
activesupport (= 3.2.14)
|
||||
railties (3.2.16)
|
||||
actionpack (= 3.2.16)
|
||||
activesupport (= 3.2.16)
|
||||
rack-ssl (~> 1.3.2)
|
||||
rake (>= 0.8.7)
|
||||
rdoc (~> 3.4)
|
||||
thor (>= 0.14.6, < 2.0)
|
||||
rake (10.1.0)
|
||||
rake (10.1.1)
|
||||
rdoc (3.12.2)
|
||||
json (~> 1.4)
|
||||
ref (1.0.5)
|
||||
rspec-expectations (2.14.2)
|
||||
rspec-expectations (2.14.4)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rubyzip (0.9.9)
|
||||
safe_yaml (0.9.5)
|
||||
rubyzip (1.1.0)
|
||||
safe_yaml (0.9.7)
|
||||
sanitize (2.0.6)
|
||||
nokogiri (>= 1.4.4)
|
||||
sass (3.2.10)
|
||||
sass (3.2.13)
|
||||
sass-rails (3.2.6)
|
||||
railties (~> 3.2.0)
|
||||
sass (>= 3.1.10)
|
||||
tilt (~> 1.3)
|
||||
selenium-webdriver (2.35.1)
|
||||
selenium-webdriver (2.39.0)
|
||||
childprocess (>= 0.2.5)
|
||||
multi_json (~> 1.0)
|
||||
rubyzip (< 1.0.0)
|
||||
rubyzip (~> 1.0)
|
||||
websocket (~> 1.0.4)
|
||||
simplecov (0.7.1)
|
||||
multi_json (~> 1.0)
|
||||
simplecov-html (~> 0.7.1)
|
||||
simplecov-html (0.7.1)
|
||||
simplecov (0.8.2)
|
||||
docile (~> 1.1.0)
|
||||
multi_json
|
||||
simplecov-html (~> 0.8.0)
|
||||
simplecov-html (0.8.0)
|
||||
sprockets (2.2.2)
|
||||
hike (~> 1.2)
|
||||
multi_json (~> 1.0)
|
||||
|
|
@ -174,23 +177,23 @@ GEM
|
|||
ref
|
||||
thor (0.18.1)
|
||||
tilt (1.4.1)
|
||||
timecop (0.6.3)
|
||||
tolk (1.3.11)
|
||||
timecop (0.7.1)
|
||||
tolk (1.3.12)
|
||||
safe_yaml (~> 0.8)
|
||||
will_paginate
|
||||
treetop (1.4.15)
|
||||
polyglot
|
||||
polyglot (>= 0.3.1)
|
||||
tzinfo (0.3.37)
|
||||
tzinfo (0.3.38)
|
||||
uglifier (1.3.0)
|
||||
execjs (>= 0.3.0)
|
||||
multi_json (~> 1.0, >= 1.0.2)
|
||||
uniform_notifier (1.3.0)
|
||||
uniform_notifier (1.4.0)
|
||||
websocket (1.0.7)
|
||||
will_paginate (3.0.4)
|
||||
will_paginate (3.0.5)
|
||||
xpath (2.0.0)
|
||||
nokogiri (~> 1.3)
|
||||
yard (0.8.7)
|
||||
yard (0.8.7.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
|
|
|||
|
|
@ -19,24 +19,24 @@ class Project < ActiveRecord::Base
|
|||
|
||||
include AASM
|
||||
aasm_column :state
|
||||
aasm_initial_state :active
|
||||
aasm.initial_state :active
|
||||
|
||||
# extend NamePartFinder
|
||||
# include Tracks::TodoList
|
||||
|
||||
aasm_state :active
|
||||
aasm_state :hidden, :enter => :hide_todos, :exit => :unhide_todos
|
||||
aasm_state :completed, :enter => :set_completed_at_date, :exit => :clear_completed_at_date
|
||||
aasm.state :active
|
||||
aasm.state :hidden, :enter => :hide_todos, :exit => :unhide_todos
|
||||
aasm.state :completed, :enter => :set_completed_at_date, :exit => :clear_completed_at_date
|
||||
|
||||
aasm_event :activate do
|
||||
aasm.event :activate do
|
||||
transitions :to => :active, :from => [:active, :hidden, :completed]
|
||||
end
|
||||
|
||||
aasm_event :hide do
|
||||
aasm.event :hide do
|
||||
transitions :to => :hidden, :from => [:active, :completed]
|
||||
end
|
||||
|
||||
aasm_event :complete do
|
||||
aasm.event :complete do
|
||||
transitions :to => :completed, :from => [:active, :hidden]
|
||||
end
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ class Project < ActiveRecord::Base
|
|||
# as a result of acts_as_state_machine calling state=() to update the attribute
|
||||
def transition_to(candidate_state)
|
||||
case candidate_state.to_sym
|
||||
when aasm_current_state
|
||||
when aasm.current_state
|
||||
return
|
||||
when :hidden
|
||||
hide!
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ class RecurringTodo < ActiveRecord::Base
|
|||
|
||||
include AASM
|
||||
aasm_column :state
|
||||
aasm_initial_state :active
|
||||
aasm.initial_state :active
|
||||
|
||||
aasm_state :active, :enter => Proc.new { |t| t.occurences_count = 0 }
|
||||
aasm_state :completed, :enter => Proc.new { |t| t.completed_at = Time.zone.now }, :exit => Proc.new { |t| t.completed_at = nil }
|
||||
aasm.state :active, :enter => Proc.new { |t| t.occurences_count = 0 }
|
||||
aasm.state :completed, :enter => Proc.new { |t| t.completed_at = Time.zone.now }, :exit => Proc.new { |t| t.completed_at = nil }
|
||||
|
||||
aasm_event :complete do
|
||||
aasm.event :complete do
|
||||
transitions :to => :completed, :from => [:active]
|
||||
end
|
||||
|
||||
aasm_event :activate do
|
||||
aasm.event :activate do
|
||||
transitions :to => :active, :from => [:completed]
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -57,23 +57,23 @@ class Todo < ActiveRecord::Base
|
|||
# state machine
|
||||
include AASM
|
||||
aasm_column :state
|
||||
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_state :active
|
||||
aasm_state :project_hidden
|
||||
aasm_state :completed, :enter => Proc.new { |t| t.completed_at = Time.zone.now }, :exit => Proc.new { |t| t.completed_at = nil}
|
||||
aasm_state :deferred, :exit => Proc.new { |t| t[:show_from] = nil }
|
||||
aasm_state :pending
|
||||
aasm.state :active
|
||||
aasm.state :project_hidden
|
||||
aasm.state :completed, :enter => Proc.new { |t| t.completed_at = Time.zone.now }, :exit => Proc.new { |t| t.completed_at = nil}
|
||||
aasm.state :deferred, :exit => Proc.new { |t| t[:show_from] = nil }
|
||||
aasm.state :pending
|
||||
|
||||
aasm_event :defer do
|
||||
aasm.event :defer do
|
||||
transitions :to => :deferred, :from => [:active]
|
||||
end
|
||||
|
||||
aasm_event :complete do
|
||||
aasm.event :complete do
|
||||
transitions :to => :completed, :from => [:active, :project_hidden, :deferred, :pending]
|
||||
end
|
||||
|
||||
aasm_event :activate do
|
||||
aasm.event :activate do
|
||||
transitions :to => :active, :from => [:project_hidden, :deferred]
|
||||
transitions :to => :active, :from => [:completed], :guard => :no_uncompleted_predecessors?
|
||||
transitions :to => :active, :from => [:pending], :guard => :no_uncompleted_predecessors_or_deferral?
|
||||
|
|
@ -81,17 +81,17 @@ class Todo < ActiveRecord::Base
|
|||
transitions :to => :deferred, :from => [:pending], :guard => :guard_for_transition_from_deferred_to_pending
|
||||
end
|
||||
|
||||
aasm_event :hide do
|
||||
aasm.event :hide do
|
||||
transitions :to => :project_hidden, :from => [:active, :deferred, :pending]
|
||||
end
|
||||
|
||||
aasm_event :unhide do
|
||||
aasm.event :unhide do
|
||||
transitions :to => :deferred, :from => [:project_hidden], :guard => Proc.new{|t| !t.show_from.blank? }
|
||||
transitions :to => :pending, :from => [:project_hidden], :guard => :uncompleted_predecessors?
|
||||
transitions :to => :active, :from => [:project_hidden]
|
||||
end
|
||||
|
||||
aasm_event :block do
|
||||
aasm.event :block do
|
||||
transitions :to => :pending, :from => [:active, :deferred, :project_hidden]
|
||||
end
|
||||
|
||||
|
|
@ -350,6 +350,7 @@ class Todo < ActiveRecord::Base
|
|||
elsif !(value.nil? || value.is_a?(NullProject))
|
||||
p = Project.find_by_name(value[:name])
|
||||
p = Project.create(value) if p.nil?
|
||||
|
||||
self.original_project=(p)
|
||||
else
|
||||
self.original_project=value
|
||||
|
|
|
|||
|
|
@ -28,4 +28,4 @@
|
|||
<% else -%><%= render :partial => "notes/notes_summary", :collection => @project.notes %>
|
||||
<% end -%>
|
||||
<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 %>
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
# TODO: is this dead code?
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
|
|
|||
|
|
@ -75,6 +75,6 @@ module Tracksapp
|
|||
|
||||
# allow onenote:// and message:// as protocols for urls
|
||||
config.action_view.sanitized_allowed_protocols = 'onenote', 'message'
|
||||
|
||||
I18n.enforce_available_locales = false
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -148,7 +148,7 @@ class ProjectTest < ActiveSupport::TestCase
|
|||
|
||||
first_todo = @moremoney.todos[0]
|
||||
first_todo.show_from = Time.zone.now + 1.week
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -186,7 +186,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
|
||||
|
|
@ -197,7 +197,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue