Sha256: edcf1afad25d8d9bcf407465492992a251b1257e21d733409db1a02f230cefdf

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

require 'proxy_pac_rb'

RSpec::Matchers.define :be_the_same_proxy_pac_file do |expected|
  define_method :loader do
    ProxyPacRb::ProxyPacLoader.new
  end

  match do |actual|
    @file_a = ProxyPacRb::ProxyPacFile.new(source: actual)
    loader.load(@file_a)

    @file_b = ProxyPacRb::ProxyPacFile.new(source: expected)
    loader.load(@file_b)

    @file_a == @file_b
  end

  diffable

  failure_message do
    format(%(expected that proxy.pac "%s" is equal to proxy.pac "%s", but it is not equal.), @file_a.source.truncate_words(10), @file_b.source.truncate_words(10))
  end

  failure_message_when_negated do
    format(%(expected that proxy.pac "%s" is not equal to proxy.pac "%s", but it is equal.), @file_a.source.truncate_words(10), @file_b.source.truncate_words(10))
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
proxy_pac_rb-0.6.3 lib/proxy_pac_rb/rspec/matchers/proxy.rb
proxy_pac_rb-0.6.2 lib/proxy_pac_rb/rspec/matchers/proxy.rb
proxy_pac_rb-0.6.1 lib/proxy_pac_rb/rspec/matchers/proxy.rb