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