Permalink
Browse files

Add tests that validate the persistence of default static / dynamic s…

…tate values
  • Loading branch information...
1 parent ffe57e3 commit 31381cbfd709c0be5c80b4c00638d7cf569586a7 @obrie obrie committed Feb 28, 2013
@@ -241,6 +241,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -326,6 +340,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -241,6 +241,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @resource.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @resource.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -307,6 +321,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @resource.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @resource.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -189,6 +189,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -255,6 +269,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -200,6 +200,20 @@ def test_should_set_attributes_prior_to_after_initialize_hook
assert_equal 'parked', state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_set_initial_state_before_setting_attributes
@model.class_eval do
attr_accessor :state_during_setter
@@ -307,6 +321,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -194,6 +194,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling
@@ -285,6 +299,20 @@ def test_should_not_set_initial_state_after_already_initialized
assert_equal 'idling', record.state
end
+ def test_should_persist_initial_state
+ record = @model.new
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
+ def test_should_persist_initial_state_on_dup
+ record = @model.create.dup
+ record.save
+ record.reload
+ assert_equal 'parked', record.state
+ end
+
def test_should_use_stored_values_when_loading_from_database
@machine.state :idling

0 comments on commit 31381cb

Please sign in to comment.