1
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
3
require 'mocha/parameter_matchers/has_key'
4
require 'mocha/inspect'
6
class HasKeyTest < Test::Unit::TestCase
8
include Mocha::ParameterMatchers
10
def test_should_match_hash_including_specified_key
11
matcher = has_key(:key_1)
12
assert matcher.matches?([{ :key_1 => 1, :key_2 => 2 }])
15
def test_should_not_match_hash_not_including_specified_key
16
matcher = has_key(:key_1)
17
assert !matcher.matches?([{ :key_2 => 2 }])
20
def test_should_describe_matcher
21
matcher = has_key(:key)
22
assert_equal 'has_key(:key)', matcher.mocha_inspect
b'\\ No newline at end of file'