Sha256: 025b99bedcfbb093817f6df7399b2e345fbc177f67f93c0b0cb9fe161cb8ed04
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
module Fakes describe ArgumentMatching do context "when creating matchers" do it "should be able to create a matcher that matches anything" do (1..10).each{|item| expect(ArgumentMatching.any.matches?(item)).to be_true} end it "should be able to create a numeric greater than matcher" do match = ArgumentMatching.greater_than(5) expect(match.matches?(4)).to be_false expect(match.matches?(5)).to be_false expect(match.matches?(6)).to be_true end it "should be able to create a range matcher" do match = ArgumentMatching.in_range((1..10)) expect(match.matches?(4)).to be_true expect(match.matches?(10)).to be_true expect(match.matches?(11)).to be_false end it "should be able to create a nil matcher" do match = ArgumentMatching.nil expect(match.matches?(nil)).to be_true expect(match.matches?(10)).to be_false end it "should be able to create a not nil matcher" do match = ArgumentMatching.not_nil expect(match.matches?(10)).to be_true expect(match.matches?(nil)).to be_false end it "should be able to create a regex string matcher" do match = ArgumentMatching.regex(/a|e|i|o|u/) expect(match.matches?("awwef")).to be_true expect(match.matches?("rwwgf")).to be_false end it "should be able to create a lambda based matcher" do match = ArgumentMatching.condition{|item| item > 3} expect(match.matches?(2)).to be_false expect(match.matches?(7)).to be_true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fakes-1.1.6 | spec/specs/argument_matching_spec.rb |
fakes-1.1.5 | spec/specs/argument_matching_spec.rb |