Renamed helpers to correspond to renamed Controller classes.
[merb_radiant.git] / radiant_extensions_plugins / plugins / scenarios / test / .svn / text-base / scenarios_test.rb.svn-base
blob28ecfb2a3a0ae714687d0123428a43b7f324cc06
1 require File.expand_path(File.dirname(__FILE__) + "/test_helper")
3 raise "RSpec should not have been loaded" if defined?(Spec)
5 class ScenariosTest < Test::Unit::TestCase
6   def setup
7     @test_result = Test::Unit::TestResult.new
9     tracking_scenario = @tracking_scenario = Class.new((:things).to_scenario) do
10       cattr_accessor :instance
11       def initialize(*args)
12         raise "Should only be created once" if self.class.instance
13         self.class.instance = super(*args)
14       end
15     end
16     @test_case = Class.new(Test::Unit::TestCase) do
17       scenario tracking_scenario
18       def test_something; end
19       def test_bad_stuff
20         raise "bad stuff"
21       end
22     end
23   end
24   
25   def test_should_unload_scenario_at_end_of_run
26     @test_case.suite.run(@test_result) {}
27     assert @tracking_scenario.instance.unloaded?
28   end
29   
30   def test_should_give_the_test_all_the_helper_methods
31     assert @test_case.instance_methods.include?("create_record")
32   end
33   
34   def test_should_load_scenarios_on_setup_and_install_helpers
35     test = @test_case.new("test_something")
36     assert_nothing_raised { test.run(@test_result) {|state,name|} }
37     assert !test.things(:one).nil?
38   end
39 end