Sha256: c164d3755947324e0e8aae5c153981440bb8c66933c697c40e22b4ab7f8861ae

Contents?: true

Size: 1.46 KB

Versions: 38

Compression:

Stored size: 1.46 KB

Contents

Feature: Test::Unit integration

  rspec-mocks 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 mocking/stubbing/doubles etc, you can have both.

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

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

      class RSpecMocksTest < Test::Unit::TestCase
        def setup
          RSpec::Mocks.setup(Object)
          RSpec::Mocks.setup(self)
        end

        def test_passing_expectation
          obj = Object.new
          expect(obj).to receive(:message)
          obj.message
        end

        def test_failing_expectation
          obj = Object.new
          expect(obj).to_not receive(:message)
          obj.message
        end

        def test_with_deprecation_warning
          obj = Object.new
          obj.stub(:old_message) { RSpec.deprecate(:old_message, :replacement => :message) }
          obj.old_message
        end
      end
      """
     When I run `ruby rspec_mocks_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: 0 times with any arguments"
     And the output should contain "old_message is deprecated. Use message instead."

Version data entries

38 entries across 38 versions & 8 rubygems

Version Path
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
rspec-mocks-2.99.4 features/test_frameworks/test_unit.feature
vagrant-cloudstack-1.1.0 vendor/bundle/gems/rspec-mocks-2.14.6/features/test_frameworks/test_unit.feature
rspec-mocks-2.99.3 features/test_frameworks/test_unit.feature
rspec-mocks-2.99.2 features/test_frameworks/test_unit.feature
dxruby_rp5-0.0.4 spec/vendor/rspec-mocks-2.14.4/features/test_frameworks/test_unit.feature
rspec-mocks-2.99.1 features/test_frameworks/test_unit.feature
rspec-mocks-2.99.0 features/test_frameworks/test_unit.feature
rspec-mocks-2.99.0.rc1 features/test_frameworks/test_unit.feature
rspec-mocks-2.14.6 features/test_frameworks/test_unit.feature
rspec-mocks-2.99.0.beta2 features/test_frameworks/test_unit.feature
rspec-mocks-2.14.5 features/test_frameworks/test_unit.feature
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/rspec-mocks-2.14.4/features/test_frameworks/test_unit.feature