Sha256: 194a472132345f0d15a627c605785691e394147733204546be2bf15e965faf5e

Contents?: true

Size: 876 Bytes

Versions: 6

Compression:

Stored size: 876 Bytes

Contents

# encoding: utf-8

$:.push(File.expand_path("../../lib", __FILE__))

require "fakeweb"
require "uri"
require "ryodo"

RSpec::Matchers.define :include_hash do |expected|

  match do |actual|
    actual.is_a?(Hash) &&
    expected.is_a?(Hash) &&
    (actual.keys & expected.keys) == expected.keys &&
    !(expected.keys.inject([]){|m,k|
        m << expected.has_value?(actual[k])
      }.uniq.include?(false))
  end

end

RYODO_SPEC_ROOT = File.expand_path("..", __FILE__)
RYODO_TMP_ROOT  = File.expand_path("../../tmp", __FILE__)

Dir.mkdir RYODO_TMP_ROOT unless File.exists?(RYODO_TMP_ROOT)

FakeWeb.register_uri(:get,
  Ryodo::PUBLIC_SUFFIX_DATA_URI,
  :body => File.read("#{RYODO_SPEC_ROOT}/_files/mozilla_effective_tld_names.dat")
  )

FakeWeb.register_uri(
  :get,
  "#{Ryodo::PUBLIC_SUFFIX_DATA_URI}&invalid_file",
  :body => "Oops!",
  :status => [404,"Not Found"]
  )

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ryodo-0.2.2 spec/spec_helper.rb
ryodo-0.2.0 spec/spec_helper.rb
ryodo-0.1.0.1 spec/spec_helper.rb
ryodo-0.1.0 spec/spec_helper.rb
ryodo-0.0.3 spec/spec_helper.rb
ryodo-0.0.2 spec/spec_helper.rb