Sha256: 6812306ffdff931a10dd86dd2624b6cf34d108dadae0c5b2469f8824dbc4b031

Contents?: true

Size: 1.17 KB

Versions: 4

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 == 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

4 entries across 4 versions & 2 rubygems

Version Path
riess-0.0.8 vendor/rspec-0.8.2/examples/test_case_spec.rb
rspec-0.8.0 examples/test_case_spec.rb
rspec-0.8.1 examples/test_case_spec.rb
rspec-0.8.2 examples/test_case_spec.rb