test/unit/expectation_test.rb in hardmock-1.2.3 vs test/unit/expectation_test.rb in hardmock-1.3.0

- old
+ new

@@ -1,8 +1,9 @@ require File.expand_path(File.dirname(__FILE__) + "/../test_helper") require 'hardmock/expectation' require 'hardmock/errors' +require 'assert_error' class ExpectationTest < Test::Unit::TestCase include Hardmock def setup @@ -342,6 +343,16 @@ assert_match(/arity/i, err.message) assert_match(/the_mock.each_bean/i, err.message) assert_match(/"a", "b", "c"/i, err.message) assert_equal [], things, "Wrong things" end + + def test_yields_bad_block_arity + se = Expectation.new(:mock => @mock, :method => 'do_later', :arguments => [] ) + se.yields + + assert_error Hardmock::ExpectationError, /block/i, /expected/i, /no param/i, /got 2/i do + se.apply_method_call(@mock,'do_later',[],lambda { |doesnt,match| raise "Surprise!" } ) + end + end + end