Sha256: 17286dd709f3f401de4aebfe1ba85dae008ba1a951fec81080675a491e97cf13

Contents?: true

Size: 1.75 KB

Versions: 41

Compression:

Stored size: 1.75 KB

Contents

require File.expand_path('../acceptance_test_helper', __FILE__)
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

41 entries across 36 versions & 6 rubygems

Version Path
challah-0.4.1 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.4.0 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.5 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.4 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.3 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.2 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.1 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.3.0 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.2.1 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
challah-0.2.0 vendor/bundle/gems/mocha-0.10.3/test/acceptance/stubba_test_result_test.rb
mocha-0.10.3 test/acceptance/stubba_test_result_test.rb
mocha-0.10.2 test/acceptance/stubba_test_result_test.rb
mocha-0.10.1 test/acceptance/stubba_test_result_test.rb
vanity-1.7.1 vendor/ruby/1.9.1/gems/mocha-0.9.12/test/acceptance/stubba_test_result_test.rb
mocha-0.10.0 test/acceptance/stubba_test_result_test.rb
mocha-0.9.12 test/acceptance/stubba_test_result_test.rb
mocha-0.9.11 test/acceptance/stubba_test_result_test.rb
mocha-0.9.10 test/acceptance/stubba_test_result_test.rb
mocha-macruby-0.9.9.20101102121900 test/acceptance/stubba_test_result_test.rb
mocha-0.9.9 test/acceptance/stubba_test_result_test.rb