Sha256: bad37f8501a3835f10e6209bf9385d70a5a19c344d01d72b46cc9081c1c3c997

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

require File.dirname(__FILE__) + '/spec_helper'
require 'test/unit'

class RSpecIntegrationTest < Test::Unit::TestCase
  def self.fixtures(*args)
    @@fixtures = true
  end
  
  def self.verify_class_method
    @@fixtures.should_be true
  end
  
  def setup
    @test_case_setup_called = true
  end

  def teardown
    @test_case_teardown_called = true
  end

  def run(result)
  end

  def helper_method
    @helper_method_called = true
  end
end

module RandomHelperModule
  def random_task
    @random_task_called = true
  end
end

context "RSpec should integrate with Test::Unit::TestCase" do
  inherit RSpecIntegrationTest
  include RandomHelperModule

  fixtures :some_table

  setup do
    @rspec_setup_called = true
  end

  specify "TestCase#setup should be called." do
    @test_case_setup_called.should_be true
    @rspec_setup_called.should_be true
  end

  specify "RSpec should be able to access TestCase methods" do
    helper_method
    @helper_method_called.should_be true
  end

  specify "RSpec should be able to accept included modules" do
    random_task
    @random_task_called.should_be true
  end
  
  teardown do
    RSpecIntegrationTest.verify_class_method
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-0.7.5 examples/test_case_spec.rb
rspec-0.7.5.1 examples/test_case_spec.rb