Sha256: a031473bc4bc22a7fa3e5122295691ffc494586f9d93250d5af7421207ef7847
Contents?: true
Size: 1.49 KB
Versions: 1
Compression:
Stored size: 1.49 KB
Contents
require File.dirname(__FILE__) + '/../lib/gecoder' module CustomVarMatchers class HaveDomain def initialize(expected) @expected = expected.to_a end def matches?(target) @target = target return false unless @target.size == @expected.size @expected.each do |element| return false unless @target.in(element) end return true end def failure_message "expected #{@target.inspect} to have domain #{@expected.inspect}" end def negative_failure_message "expected #{@target.inspect} not to have domain #{@expected.inspect}" end end # Tests whether a variable has the expected domain. def have_domain(expected) HaveDomain.new(expected) end class IsAlias def initialize(expected) @expected = expected.to_a end def matches?(target) @target = target return false unless @target.size == @expected.size @expected.each do |element| return false unless @target.in(element) end return true end def failure_message "expected #{@target.inspect} to be an alias of #{@expected.inspect}" end def negative_failure_message "expected #{@target.inspect} not to be an alias of #{@expected.inspect}" end end # Tests whether a method with a specified name is the alias of another. def is_alias_of(expected) HaveDomain.new(expected) end end Spec::Runner.configure do |config| config.include(CustomVarMatchers) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gecoder-0.4.0 | specs/spec_helper.rb |