Sha256: 9bd6d7fa44353a898668b410fe111180771ddca2733353acc2b7c2626ed829a8

Contents?: true

Size: 792 Bytes

Versions: 2

Compression:

Stored size: 792 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 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( {: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

2 entries across 2 versions & 1 rubygems

Version Path
contrast-1.1.0 spec/contrast/matching_exception_spec.rb
contrast-1.0.0 spec/contrast/matching_exception_spec.rb