Sha256: b44f3483d524342efbf5801322de7e6e4753aeb64e5bab832c9c756fe41f2575

Contents?: true

Size: 1.75 KB

Versions: 15

Compression:

Stored size: 1.75 KB

Contents

require File.join(File.dirname(__FILE__), "acceptance_test_helper")
require 'mocha'
require 'execution_point'

class StubbaTestResultTest < Test::Unit::TestCase
  
  include AcceptanceTest
  
  def setup
    setup_acceptance_test
  end
  
  def teardown
    teardown_acceptance_test
  end
  
  def test_should_include_expectation_verification_in_assertion_count
    test_result = run_as_test do
      object = Class.new { def message; end }.new
      object.expects(:message)
      object.message
    end
    assert_equal 1, test_result.assertion_count
  end
  
  def test_should_include_assertions_in_assertion_count
    test_result = run_as_test do
      assert true
    end
    assert_equal 1, test_result.assertion_count
  end
  
  def test_should_not_include_stubbing_expectation_verification_in_assertion_count
    test_result = run_as_test do
      object = Class.new { def message; end }.new
      object.stubs(:message)
      object.message
    end
    assert_equal 0, test_result.assertion_count
  end
  
  def test_should_include_expectation_verification_failure_in_failure_count
    test_result = run_as_test do
      object = Class.new { def message; end }.new
      object.expects(:message)
    end
    assert_equal 1, test_result.failure_count
  end
  
  def test_should_include_assertion_failure_in_failure_count
    test_result = run_as_test do
      flunk
    end
    assert_equal 1, test_result.failure_count
  end
  
  def test_should_display_backtrace_indicating_line_number_where_failing_assertion_was_called
    execution_point = nil
    test_result = run_as_test do
      execution_point = ExecutionPoint.current; flunk
    end
    assert_equal 1, test_result.failure_count
    assert_equal execution_point, ExecutionPoint.new(test_result.failures[0].location)
  end
  
end

Version data entries

15 entries across 15 versions & 5 rubygems

Version Path
floehopper-mocha-0.9.6.20090629164857 test/acceptance/stubba_test_result_test.rb
floehopper-mocha-0.9.6.20090629165308 test/acceptance/stubba_test_result_test.rb
floehopper-mocha-0.9.6.20090701111305 test/acceptance/stubba_test_result_test.rb
floehopper-mocha-0.9.7.20090701124354 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.5.0.1240002286 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.5.0.1240351621 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.5.0.1241126838 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.7.0.1247796736 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.7.20090701124354 test/acceptance/stubba_test_result_test.rb
jferris-mocha-0.9.7.20090911190113 test/acceptance/stubba_test_result_test.rb
mocha-macruby-0.9.8.20100129120100 test/acceptance/stubba_test_result_test.rb
mcmire-mocha-0.9.8 test/acceptance/stubba_test_result_test.rb
mocha-0.9.8 test/acceptance/stubba_test_result_test.rb
mocha-0.9.6 test/acceptance/stubba_test_result_test.rb
mocha-0.9.7 test/acceptance/stubba_test_result_test.rb