Sha256: d9f0c72bbf066d792b94a1f359c9fcbcffc3f4d76f3fa6e564c36a89eaf15dbe

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
require 'hardmock/method_cleanout'
require 'hardmock/mock_control'
require 'hardmock/errors'
require 'hardmock/expectation_builder'
require 'hardmock/expectation'
require 'hardmock/mock'

class VerifyErrorTest < Test::Unit::TestCase
  include Hardmock

  #
  # TESTS
  #

  def test_formatted_list_of_unmet_expectations
    mock1 = Mock.new('mock1')
    mock2 = Mock.new('mock2')
    exp1 = Expectation.new( :mock => mock1, :method => 'send_parts', :arguments => [1,2,:a] )
    exp2 = Expectation.new( :mock => mock2, :method => 'grind_it', :arguments => [] )

    exp_list = [ exp1, exp2 ]

    err = VerifyError.new("This is the error", exp_list)
    assert_equal "This is the error:\n * #{exp1.to_s}\n * #{exp2.to_s}", err.message
  end

  def test_empty_list_of_expectations
    # this is not a normal case; not spending a lot of time to make this better
    exp_list = []
    err = VerifyError.new("This is the error:\n", exp_list)
  end

  def test_nil_expectation_list
    # this is not a normal case; not spending a lot of time to make this better
    exp_list = []
    err = VerifyError.new("This is the error:\n", exp_list)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-0.29.1 vendor/hardmock/test/unit/verify_error_test.rb
ceedling-0.29.0 vendor/hardmock/test/unit/verify_error_test.rb