Sha256: 83e7cb6f01df3e240d2bc1e278ad7ada9816f8130434a6fec5329806b09c1427

Contents?: true

Size: 1.77 KB

Versions: 6

Compression:

Stored size: 1.77 KB

Contents

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

module RR
module Expectations
  describe ArgumentEqualityError, "==" do
    before do
      @expectation = ArgumentEqualityError.new(1, 2, 3)
    end
    
    it "returns true when passed in expected_arguments are equal" do
      @expectation.should == ArgumentEqualityError.new(1, 2, 3)
    end

    it "returns false when passed in expected_arguments are not equal" do
      @expectation.should_not == ArgumentEqualityError.new(1, 2)
      @expectation.should_not == ArgumentEqualityError.new(1)
      @expectation.should_not == ArgumentEqualityError.new(:something)
      @expectation.should_not == ArgumentEqualityError.new()
    end
  end

  describe ArgumentEqualityError, "#exact_match?" do
    before do
      @expectation = ArgumentEqualityError.new(1, 2, 3)
    end

    it "returns true when all arguments exactly match" do
      @expectation.should be_exact_match(1, 2, 3)
      @expectation.should_not be_exact_match(1, 2)
      @expectation.should_not be_exact_match(1)
      @expectation.should_not be_exact_match()
      @expectation.should_not be_exact_match("does not match")
    end
  end

  describe ArgumentEqualityError, "#wildcard_match?" do
    it "returns false when not exact match" do
      @expectation = ArgumentEqualityError.new(1)
      @expectation.should_not be_wildcard_match(1, 2, 3)
      @expectation.should_not be_wildcard_match("whatever")
      @expectation.should_not be_wildcard_match("whatever", "else")
    end

    it "returns true when exact match" do
      @expectation = ArgumentEqualityError.new(1, 2)
      @expectation.should be_wildcard_match(1, 2)
      @expectation.should_not be_wildcard_match(1)
      @expectation.should_not be_wildcard_match("whatever", "else")
    end
  end
end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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