Sha256: e7f7ba5138cf107dad4f6c59c0834c4eda61b1873726255b17e5585fda1bd694
Contents?: true
Size: 1.74 KB
Versions: 7
Compression:
Stored size: 1.74 KB
Contents
shared_examples_for "wildcard match" do |actual, matcher, *args| expected = matcher.inspect + (args.size > 0 ? "(#{args.map(&:inspect).join(", ")})" : "") it "#{actual.inspect} with #{expected}" do if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher) # Note: some symbol comes here and may fail wildcard_match?(actual, send(matcher, *args)).should be_true else wildcard_match?(actual, matcher).should be_true end end end shared_examples_for "not wildcard match" do |actual, matcher, *args| expected = matcher.inspect + (args.size > 0 ? "(#{args.map(&:inspect).join(", ")})" : "") it "#{actual.inspect} with #{expected}" do if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher) # Note: some symbol comes here and may fail wildcard_match?(actual, send(matcher, *args)).should be_false else wildcard_match?(actual, matcher).should be_false end end end shared_examples_for "wildcard match with helper" do |actual, helper, matcher, *args| matcher_string =if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher) matcher.to_s else matcher.inspect end expected = helper.to_s + "(" + (args.size > 0 ? "(#{matcher_string}(#{args.map(&:inspect).join(",")})" : matcher_string) + ")" it "#{actual.inspect} with #{expected}" do if matcher.is_a?(Symbol) and WildcardMatchers.respond_to?(matcher) # Note: some symbol comes here and may fail wildcard_match?(actual, send(helper, send(matcher, *args))).should be_true else wildcard_match?(actual, send(helper, matcher)).should be_true end end end
Version data entries
7 entries across 7 versions & 1 rubygems