~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/mocha-0.5.6/test/unit/parameter_matchers/has_key_test.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.join(File.dirname(__FILE__), "..", "..", "test_helper")
 
2
 
 
3
require 'mocha/parameter_matchers/has_key'
 
4
require 'mocha/inspect'
 
5
 
 
6
class HasKeyTest < Test::Unit::TestCase
 
7
  
 
8
  include Mocha::ParameterMatchers
 
9
  
 
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 }])
 
13
  end
 
14
  
 
15
  def test_should_not_match_hash_not_including_specified_key
 
16
    matcher = has_key(:key_1)
 
17
    assert !matcher.matches?([{ :key_2 => 2 }])
 
18
  end
 
19
  
 
20
  def test_should_describe_matcher
 
21
    matcher = has_key(:key)
 
22
    assert_equal 'has_key(:key)', matcher.mocha_inspect
 
23
  end
 
24
  
 
25
end
 
 
b'\\ No newline at end of file'