Sha256: 2412e47dfaf9fc6ead19de61fe849a22f0222236244c08e12fd465843d2f1f2c

Contents?: true

Size: 637 Bytes

Versions: 17

Compression:

Stored size: 637 Bytes

Contents

module IMWTest
  module CustomMatchers

    class FileContentsMatcher
      def initialize orig
        @orig = File.expand_path orig
      end

      def matches? copy
        @copy = File.expand_path copy
        File.compare(@orig,@copy)
      end

      def failure_message
        "files #{@orig} and #{@copy} are different"
      end

      def negative_failure_message
        "expected files #{@orig} and #{@copy} to differ"
      end
    end

    # Matches the contents of one file against another using
    # File.compare.
    def have_contents_matching_those_of path
      FileContentsMatcher.new(path)
    end
    
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
imw-0.2.18 spec/support/file_contents_matcher.rb
imw-0.2.17 spec/support/file_contents_matcher.rb
imw-0.2.16 spec/support/file_contents_matcher.rb
imw-0.2.15 spec/support/file_contents_matcher.rb
imw-0.2.14 spec/support/file_contents_matcher.rb
imw-0.2.13 spec/support/file_contents_matcher.rb
imw-0.2.12 spec/support/file_contents_matcher.rb
imw-0.2.11 spec/support/file_contents_matcher.rb
imw-0.2.10 spec/support/file_contents_matcher.rb
imw-0.2.9 spec/support/file_contents_matcher.rb
imw-0.2.8 spec/support/file_contents_matcher.rb
imw-0.2.7 spec/support/file_contents_matcher.rb
imw-0.2.6 spec/support/file_contents_matcher.rb
imw-0.2.5 spec/support/file_contents_matcher.rb
imw-0.2.4 spec/support/file_contents_matcher.rb
imw-0.2.3 spec/support/file_contents_matcher.rb
imw-0.2.2 spec/support/file_contents_matcher.rb