Sha256: 9168671550bcde7bdb82ef728ec8a0175df959bc7e8ac49675fc1e438db49a3b

Contents?: true

Size: 1.15 KB

Versions: 39

Compression:

Stored size: 1.15 KB

Contents

require File.expand_path('../../../test_helper', __FILE__)

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

39 entries across 31 versions & 3 rubygems

Version Path
mocha-0.12.10 test/unit/parameter_matchers/includes_test.rb
mocha-0.12.9 test/unit/parameter_matchers/includes_test.rb
mocha-0.13.2 test/unit/parameter_matchers/includes_test.rb
mocha-0.12.8 test/unit/parameter_matchers/includes_test.rb
mocha-0.13.1 test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.12.3/test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.13.0/test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.3/test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/mocha-0.12.2/test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.2.0 vendor/bundle/gems/challah-0.8.3/vendor/bundle/gems/mocha-0.13.0/test/unit/parameter_matchers/includes_test.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.13.0/test/unit/parameter_matchers/includes_test.rb
challah-0.8.3 vendor/bundle/gems/mocha-0.12.3/test/unit/parameter_matchers/includes_test.rb
mocha-0.13.0 test/unit/parameter_matchers/includes_test.rb
mocha-0.12.7 test/unit/parameter_matchers/includes_test.rb
mocha-0.12.6 test/unit/parameter_matchers/includes_test.rb
mocha-0.12.5 test/unit/parameter_matchers/includes_test.rb
challah-0.8.1 vendor/bundle/gems/mocha-0.12.3/test/unit/parameter_matchers/includes_test.rb
mocha-0.12.4 test/unit/parameter_matchers/includes_test.rb
challah-rolls-0.1.0 vendor/bundle/gems/challah-0.8.0.pre/vendor/bundle/gems/mocha-0.12.2/test/unit/parameter_matchers/includes_test.rb