public
Description: A Rails plugin to make creating a wizard easy and with a lot less code
Clone URL: git://github.com/Adkron/actsaswizard.git
Click here to lend your support to: actsaswizard and make a donation at www.pledgie.com !
setup the rake file and test helper.  also added testing on the Exceptions 
rcov at 75.5%
Adkron (author)
Fri May 30 16:26:00 -0700 2008
commit  7009dce343069bf0cda8a361fa55413d986bbbdc
tree    66b6b2b814fd72de3762c81c111d2376dbbc5d41
parent  814613f95cc13eac999a1bd9e7e2a177d518452c
...
8
9
10
11
 
12
13
14
...
8
9
10
 
11
12
13
14
0
@@ -8,7 +8,7 @@ task :default => :test
0
 desc 'Test the acts_as_wizard plugin.'
0
 Rake::TestTask.new(:test) do |t|
0
   t.libs << 'lib'
0
- t.pattern = 'test/**/*_test.rb'
0
+ t.pattern = 'test/*_test.rb'
0
   t.verbose = true
0
 end
0
 
...
13
14
15
16
 
17
18
19
...
13
14
15
 
16
17
18
19
0
@@ -13,7 +13,7 @@ module AmosKing #:nodoc:
0
         def message
0
           "ErrPages: At least one pages must be specified"
0
         end
0
- end
0
+ end
0
 
0
       # The Exception raised when acts_as_state_machine is not found
0
       class ErrRequireAASM < Exception #:nodoc:
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 
39
40
41
...
43
44
45
46
 
 
 
 
 
 
 
 
47
48
49
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
...
6
7
8
 
9
10
11
12
13
14
15
16
17
18
19
0
@@ -1,41 +1,4 @@
0
-require 'rubygems'
0
-require 'test/unit'
0
-require 'mocha'
0
-gem 'activerecord'
0
-gem 'actionpack'
0
-require 'activerecord'
0
-require 'action_controller'
0
-require 'action_controller/test_process'
0
-require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. init]))
0
-
0
-# Load acts_as_state_machine and initialize it
0
-require File.expand_path(File.join(File.dirname(__FILE__), *%w[.. .. acts_as_state_machine lib acts_as_state_machine]))
0
-ActiveRecord::Base.class_eval do
0
- include ScottBarron::Acts::StateMachine
0
-end
0
-
0
-# setup db
0
-config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
0
-ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
0
-ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
0
-# load schema file
0
-load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(File.dirname(__FILE__) + "/schema.rb")
0
-
0
-
0
-class MainModel < ActiveRecord::Base
0
- acts_as_wizard :first_page, :second_page
0
-end
0
-
0
-class FirstPage < ActiveRecord::Base
0
- acts_as_wizard_page :main_model
0
-end
0
-
0
-class SecondPage < ActiveRecord::Base
0
- acts_as_wizard_page :main_model
0
-end
0
-
0
-class EmptyModel < ActiveRecord::Base
0
-end
0
+require File.expand_path(File.join(File.dirname(__FILE__), *%w[test_helper]))
0
 
0
 class ActsAsWizardTest < Test::Unit::TestCase
0
   def setup
0
@@ -43,7 +6,14 @@ class ActsAsWizardTest < Test::Unit::TestCase
0
     @main_model.save
0
   end
0
   
0
- # Replace this with your real tests.
0
+ def test_err_pages_message
0
+ assert_equal("ErrPages: At least one pages must be specified",AmosKing::Acts::Wizard::ErrPages.new.message)
0
+ end
0
+
0
+ def test_err_pages_message
0
+ assert_equal("Requires acts as state machine plugin",AmosKing::Acts::Wizard::ErrRequireAASM.new.message)
0
+ end
0
+
0
   def test_requires_options_for_acts_as_wizard
0
     assert_raise(AmosKing::Acts::Wizard::ErrPages) { EmptyModel.acts_as_wizard }
0
   end

Comments

    No one has commented yet.