Sha256: b3066ac65bdbda7db3df17b01362a854946a9edd1123d2047c8081841338c48e

Contents?: true

Size: 835 Bytes

Versions: 3

Compression:

Stored size: 835 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe Contrast::MatchingException do
  describe "#to_s" do
    it 'no results: The results did not match, but I cannot tell you why.' do
      [nil, []]. each do |value|
        error = Contrast::MatchingException.new
        error.results = value
        get_message_for(error).must_equal 'The results did not match, but I cannot tell you why.'
      end
    end

    it "results: Run them through awesome print" do
      error = Contrast::MatchingException.new
      error.results = {:result => nil}
      error.results.expects(:ai).returns('expected results')
      get_message_for(error).must_equal 'expected results'
    end
  end

  def get_message_for(error)
    begin
      raise error
    rescue Exception => e
      return e.message
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
contrast-0.2.2 spec/contrast/matching_exception_spec.rb
contrast-0.2.1 spec/contrast/matching_exception_spec.rb
contrast-0.2.0 spec/contrast/matching_exception_spec.rb