Sha256: 76e51ce0d15dc1beac3f81ec7d767b8631d3a30d846ef086c6c0ace4dd574c40

Contents?: true

Size: 1.76 KB

Versions: 6

Compression:

Stored size: 1.76 KB

Contents

dir = File.dirname(__FILE__)
require "#{dir}/../../example_helper"

module RR
module Expectations
  describe ArgumentEqualityError, "#exact_match? with range argument" do
    before do
      @expectation = ArgumentEqualityError.new(2..5)
    end
    
    it "returns true when passed in an Range matcher with the same argument list" do
      @expectation.should be_exact_match(2..5)
    end

    it "returns false when passed in an Range matcher with a different argument list" do
      @expectation.should_not be_exact_match(3..6)
    end

    it "returns false otherwise" do
      @expectation.should_not be_exact_match(2)
      @expectation.should_not be_exact_match(:hello)
      @expectation.should_not be_exact_match(3)
      @expectation.should_not be_exact_match(nil)
      @expectation.should_not be_exact_match(true)
      @expectation.should_not be_exact_match()
    end
  end

  describe ArgumentEqualityError, "#wildcard_match? with Range argument" do
    before do
      @expectation = ArgumentEqualityError.new(2..6)
    end

    it "returns true when string matches the range" do
      @expectation.should be_wildcard_match(3)
    end

    it "returns false when string does not match the range" do
      @expectation.should_not be_wildcard_match(7)
    end

    it "returns true when an exact match" do
      @expectation.should be_wildcard_match(2..6)
    end

    it "returns false when not an exact match" do
      @expectation.should_not be_wildcard_match(3..9)
    end

    it "returns false when not a number" do
      @expectation.should_not be_wildcard_match("Not a number")
    end

    it "returns false when not passed correct number of arguments" do
      @expectation.should_not be_wildcard_match()
      @expectation.should_not be_wildcard_match(2, 3)
    end
  end
end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rr-0.1.1 examples/rr/expectations/range_argument_equality_expectation_example.rb
rr-0.1.4 examples/rr/expectations/range_argument_equality_expectation_example.rb
rr-0.1.2 examples/rr/expectations/range_argument_equality_expectation_example.rb
rr-0.1.6 examples/rr/expectations/range_argument_equality_expectation_example.rb
rr-0.1.5 examples/rr/expectations/range_argument_equality_expectation_example.rb
rr-0.1.3 examples/rr/expectations/range_argument_equality_expectation_example.rb