Sha256: 44aa01be8ae35af4c9e4a7f795b64a187a28c6ead11072ba85c2eedb82c36439

Contents?: true

Size: 1.67 KB

Versions: 3

Compression:

Stored size: 1.67 KB

Contents

require File.expand_path('../../spec_helper', __FILE__)
require File.expand_path('../../../common/adapter_integration_tests', __FILE__)
require File.expand_path('../../../common/rails_integration_test', __FILE__)

describe 'Integration between TestUnit 2 and Rails' do
  include AdapterIntegrationTests
  include IntegrationWithRails

  def bootstrap(opts={})
    str = ""
    str << <<-EOT
      RAILS_ROOT = File.expand_path(__FILE__)
      require 'rubygems'
    EOT
    str << "require 'rr'\n" if opts[:include_rr_before]
    str << <<-EOT
      require 'rack'
      require 'test/unit'
      require 'active_support/all'
      require 'action_controller'
      require 'active_support/test_case'
    EOT
    str << "require 'rr'\n" unless opts[:include_rr_before]
    str
  end

  def error_test
    <<-EOT
      #{bootstrap}

      class FooTest < ActiveSupport::TestCase
        def test_foo
          object = Object.new
          mock(object).foo
        end
      end
    EOT
  end

  def include_adapter_test
    <<-EOT
      #{bootstrap}

      class ActiveSupport::TestCase
        include RR::Adapters::TestUnit
      end

      class FooTest < ActiveSupport::TestCase
        def test_foo
          object = Object.new
          mock(object).foo
          object.foo
        end
      end
    EOT
  end

  def include_adapter_where_rr_included_before_test_framework_test
    <<-EOT
      #{bootstrap :include_rr_before => true}

      class ActiveSupport::TestCase
        include RR::Adapters::TestUnit
      end

      class FooTest < ActiveSupport::TestCase
        def test_foo
          object = Object.new
          mock(object).foo
          object.foo
        end
      end
    EOT
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rr-1.1.0 spec/suites/rspec_1/integration/test_unit_2_rails_spec.rb
rr-1.1.0.rc3 spec/suites/rspec_1/integration/test_unit_2_rails_spec.rb
rr-1.1.0.rc2 spec/suites/rspec_1/integration/test_unit_2_rails_spec.rb