Sha256: 189d73921619669949507a449915e61db9331d9679ad976f418c30e3674bcf6c

Contents?: true

Size: 681 Bytes

Versions: 4

Compression:

Stored size: 681 Bytes

Contents

# frozen_string_literal: true
RSpec::Matchers.define :be_existing_file do |_|
  match { |actual| File.file?(actual) }

  failure_message do |actual|
    format('expected that file "%s" exists', actual)
  end

  failure_message_when_negated do |actual|
    format('expected that file "%s" does not exist', actual)
  end
end

RSpec::Matchers.define :have_content do |expected|
  match { |actual| File.read(actual).chomp == expected.chomp }

  failure_message do |actual|
    format("expected that file \"%s\" contains:\n%s", actual, expected)
  end

  failure_message_when_negated do |actual|
    format("expected that file \"%s\" does not contain:\n%s", actual, expected)
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
proxy_pac_rb-3.0.0 spec/support/matchers/file.rb
proxy_pac_rb-2.1.0 spec/support/matchers/file.rb
proxy_pac_rb-2.0.0 spec/support/matchers/file.rb
proxy_pac_rb-1.0.0 spec/support/matchers/file.rb