summaryrefslogtreecommitdiff
path: root/test/unit/manufacturer_test.rb
diff options
context:
space:
mode:
authorStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
committerStefan Wintermeyer <stefan.wintermeyer@amooma.de>2012-12-17 12:01:45 +0100
commitb80bd744ad873f6fc43018bc4bfb90677de167bd (patch)
tree072c4b0e33d442528555b82c415f5e7a1712b2b0 /test/unit/manufacturer_test.rb
parent3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff)
Start of GS5.
Diffstat (limited to 'test/unit/manufacturer_test.rb')
-rw-r--r--test/unit/manufacturer_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/manufacturer_test.rb b/test/unit/manufacturer_test.rb
new file mode 100644
index 0000000..635a977
--- /dev/null
+++ b/test/unit/manufacturer_test.rb
@@ -0,0 +1,27 @@
+require 'test_helper'
+
+class ManufacturerTest < ActiveSupport::TestCase
+ def test_should_have_a_valid_factory
+ assert Factory.build(:manufacturer).valid?
+ end
+
+ # StateMachine Tests:
+ def test_that_the_initial_state_should_be_active
+ @manufacturer = Factory.create(:manufacturer)
+ assert_equal 'active', @manufacturer.state
+ assert @manufacturer.active?
+ end
+
+ def test_not_active_state_will_not_be_displayed
+ @manufacturer = Factory.create(:manufacturer)
+ assert_equal 1, Manufacturer.count
+
+ @manufacturer.deactivate!
+ assert_equal 0, Manufacturer.count
+ assert_equal 1, Manufacturer.unscoped.count
+
+ @manufacturer.activate!
+ assert_equal 1, Manufacturer.count
+ assert_equal Manufacturer.count, Manufacturer.unscoped.count
+ end
+end