Sha256: d40c92c1dd95f80785ebc1b973ea6967bdfd5021bd70499baeb86afb99ab894a

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require File.join(File.dirname(__FILE__), "..", "..", "test_helper")

require 'mocha/parameter_matchers/includes'
require 'mocha/inspect'

class IncludesTest < Test::Unit::TestCase

  include Mocha::ParameterMatchers

  def test_should_match_object_including_value
    matcher = includes(:x)
    assert matcher.matches?([[:x, :y, :z]])
  end

  def test_should_not_match_object_that_does_not_include_value
    matcher = includes(:not_included)
    assert !matcher.matches?([[:x, :y, :z]])
  end

  def test_should_describe_matcher
    matcher = includes(:x)
    assert_equal "includes(:x)", matcher.mocha_inspect
  end
  
  def test_should_not_raise_error_on_emtpy_arguments
    matcher = includes(:x)
    assert_nothing_raised { matcher.matches?([]) }
  end
  
  def test_should_not_match_on_empty_arguments
    matcher = includes(:x)
    assert !matcher.matches?([])
  end
  
  def test_should_not_raise_error_on_argument_that_does_not_respond_to_include
    matcher = includes(:x)
    assert_nothing_raised { matcher.matches?([:x]) }
  end
  
  def test_should_not_match_on_argument_that_does_not_respond_to_include
    matcher = includes(:x)
    assert !matcher.matches?([:x])
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
mocha-macruby-0.9.8.20100129120100 test/unit/parameter_matchers/includes_test.rb
mcmire-mocha-0.9.8 test/unit/parameter_matchers/includes_test.rb
mocha-0.9.8 test/unit/parameter_matchers/includes_test.rb