Sha256: 7fb939aa7b8edb8f44115b99c128f0860b0c28b9267d5b4b60bbaa60216f7f3d

Contents?: true

Size: 1.16 KB

Versions: 6

Compression:

Stored size: 1.16 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/test_helper")

raise "RSpec should not have been loaded" if defined?(Spec)

class ScenariosTest < Test::Unit::TestCase
  def setup
    @test_result = Test::Unit::TestResult.new

    tracking_scenario = @tracking_scenario = Class.new((:things).to_scenario) do
      cattr_accessor :instance
      def initialize(*args)
        raise "Should only be created once" if self.class.instance
        self.class.instance = super(*args)
      end
    end
    @test_case = Class.new(Test::Unit::TestCase) do
      scenario tracking_scenario
      def test_something; end
      def test_bad_stuff
        raise "bad stuff"
      end
    end
  end
  
  def test_should_unload_scenario_at_end_of_run
    @test_case.suite.run(@test_result) {}
    assert @tracking_scenario.instance.unloaded?
  end
  
  def test_should_give_the_test_all_the_helper_methods
    assert @test_case.instance_methods.include?("create_record")
  end
  
  def test_should_load_scenarios_on_setup_and_install_helpers
    test = @test_case.new("test_something")
    assert_nothing_raised { test.run(@test_result) {|state,name|} }
    assert !test.things(:one).nil?
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
radiant-0.6.5.1 vendor/plugins/scenarios/test/scenarios_test.rb
radiant-0.6.5 vendor/plugins/scenarios/test/scenarios_test.rb
radiant-0.6.6 vendor/plugins/scenarios/test/scenarios_test.rb
radiant-0.6.7 vendor/plugins/scenarios/test/scenarios_test.rb
radiant-0.6.8 vendor/plugins/scenarios/test/scenarios_test.rb
radiant-0.6.9 vendor/plugins/scenarios/test/scenarios_test.rb