Sha256: c3728e81fae8413e7ff2a2f32466af76bc23a39efc392cd4e2a8f8a314d2bd3d

Contents?: true

Size: 1.62 KB

Versions: 31

Compression:

Stored size: 1.62 KB

Contents

Feature: Test::Unit integration

  RSpec-expectations is a stand-alone gem that can be used without the rest of
  RSpec. If you like the way Test::Unit (or MiniTest) organizes tests, but
  prefer RSpec's approach to expressing expectations, you can have both.

  The one downside is that failures are reported as errors with MiniTest.

  Scenario: use rspec/expectations with Test::Unit
    Given a file named "rspec_expectations_test.rb" with:
      """ruby
      require 'test/unit'
      require 'rspec/expectations'

      class RSpecExpectationsTest < Test::Unit::TestCase
        RSpec::Matchers.define :be_an_integer do
          match { |actual| Integer === actual }
        end

        def be_an_int
          # This is actually an internal rspec-expectations API, but is used
          # here to demonstrate that deprecation warnings from within
          # rspec-expectations work correcty without depending on rspec-core
          RSpec.deprecate(:be_an_int, :replacement => :be_an_integer)
          be_an_integer
        end

        def test_passing_expectation
          expect(1 + 3).to eq 4
        end

        def test_failing_expectation
          expect([1,2]).to be_empty
        end

        def test_custom_matcher_with_deprecation_warning
          expect(1).to be_an_int
        end
      end
      """
     When I run `ruby rspec_expectations_test.rb`
     Then the output should contain "3 tests, 0 assertions, 0 failures, 1 errors" or "3 tests, 0 assertions, 1 failures, 0 errors"
      And the output should contain "expected empty? to return true, got false"
      And the output should contain "be_an_int is deprecated"

Version data entries

31 entries across 31 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-expectations-2.14.5/features/test_frameworks/test_unit.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
rspec-expectations-2.14.5 features/test_frameworks/test_unit.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
dxruby_rp5-0.0.3 spec/vendor/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
tuktuk-rails-0.0.10 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
tuktuk-rails-0.0.9 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
tuktuk-rails-0.0.8 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
tuktuk-rails-0.0.7 vendor/bundle/ruby/2.0.0/gems/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
dxruby_rp5-0.0.2 spec/vendor/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature
dxruby_rp5-0.0.1 spec/vendor/rspec-expectations-2.14.4/features/test_frameworks/test_unit.feature