Sha256: 7bc78ab4bfa8b2dd85de363efddfccef3e7717d216e58f980b3036aa111bfcea

Contents?: true

Size: 1.92 KB

Versions: 13

Compression:

Stored size: 1.92 KB

Contents

Feature: Spec and test together

  As an RSpec adopter with existing Test::Unit tests
  I want to run a few specs alongside my existing Test::Unit tests
  So that I can experience a smooth, gradual migration path

  Scenario Outline: Run specs and tests together
    Given a file named "spec_and_test_together.rb" with:
    """
    require 'rspec/autorun'
    require 'spec/test/unit'

    describe "An Example" do
      it "should pass with assert" do
        assert true
      end

      it "should fail with assert" do
        assert false
      end

      it "should pass with should" do
        1.should == 1
      end

      it "should fail with should" do
        1.should == 2
      end
    end

    class ATest < Test::Unit::TestCase
      def test_should_pass_with_assert
        assert true
      end

      def test_should_fail_with_assert
        assert false
      end

      def test_should_pass_with_should
        1.should == 1
      end

      def test_should_fail_with_should
        1.should == 2
      end

      def setup
        @from_setup ||= 3
        @from_setup += 1
      end

      def test_should_fail_with_setup_method_variable
        @from_setup.should == 40
      end

      before do
        @from_before = @from_setup + 1
      end

      def test_should_fail_with_before_block_variable
        @from_before.should == 50
      end
    end
    """

    When I run "<Command> spec_and_test_together.rb -fs"

    Then the exit code should be 256
    And the stdout should match "ATest"
    And the stdout should match "Test::Unit::AssertionFailedError in 'An Example should fail with assert'"
    And the stdout should match "'An Example should fail with should' FAILED"
    And the stdout should match "10 examples, 6 failures"
    And the stdout should match /expected: 40,\s*got: 4/m
    And the stdout should match /expected: 50,\s*got: 5/m

  Scenarios: run with ruby and spec
    | Command |
    | ruby    |
    | spec    |

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rspec-core-2.0.0.beta.3 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.beta.2 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.beta.1 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a10 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a9 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a8 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a7 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a6 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a5 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a4 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a3 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a2 features-pending/interop/examples_and_tests_together.feature
rspec-core-2.0.0.a1 features-pending/interop/examples_and_tests_together.feature