Sha256: d48530e3b347d4a75b9a1667132eab49d66b6dd8fbe35b8d44293aef6f0e86b4

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require File.join(File.dirname(__FILE__), "..", "test_helper")
require 'mocha'
require 'test_runner'

class PartialMockAcceptanceTest < Test::Unit::TestCase
  
  include TestRunner

  def test_should_pass_if_all_expectations_are_satisfied
    test_result = run_test do
      partial_mock_one = "partial_mock_one"
      partial_mock_two = "partial_mock_two"
      
      partial_mock_one.expects(:first)
      partial_mock_one.expects(:second)
      partial_mock_two.expects(:third)
      
      partial_mock_one.first
      partial_mock_one.second
      partial_mock_two.third
    end
    assert_passed(test_result)
  end

  def test_should_fail_if_all_expectations_are_not_satisfied
    test_result = run_test do
      partial_mock_one = "partial_mock_one"
      partial_mock_two = "partial_mock_two"
      
      partial_mock_one.expects(:first)
      partial_mock_one.expects(:second)
      partial_mock_two.expects(:third)
      
      partial_mock_one.first
      partial_mock_two.third
    end
    assert_failed(test_result)
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mocha-0.5.6 test/acceptance/partial_mocks_acceptance_test.rb