Sha256: d1094d45d7b0e46f90907a984f504a9601859384614516e5fe8faf70e51f9281

Contents?: true

Size: 873 Bytes

Versions: 6

Compression:

Stored size: 873 Bytes

Contents

require 'coveralls'
Coveralls.wear!

$LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
require 'har'
require 'pry'

module HAR
  module SpecHelper
    def fixture_path(name)
      File.join(File.expand_path("../fixtures", __FILE__), name)
    end

    def har_path(name)
      fixture_path File.join("hars", "#{name}.har")
    end

    def json(path)
      JSON.parse(File.read(path))
    end

    def all_hars
      Dir[fixture_path("hars/*.har")]
    end

    def google_path
      har_path "google.com"
    end

    def good_hars
      all_hars.reject { |e| e =~ /bad/ }
    end

    def with_stdin_replaced_by(file_path)
      stdin = $stdin
      begin
        File.open(file_path, "r") { |io|
          $stdin = io
          yield
        }
      ensure
        $stdin = stdin
      end
    end
  end
end

RSpec.configure do |c|
  c.include HAR::SpecHelper
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
har-0.1.5 spec/spec_helper.rb
har-0.1.4 spec/spec_helper.rb
har-0.1.3 spec/spec_helper.rb
har-0.1.2 spec/spec_helper.rb
har-0.1.1 spec/spec_helper.rb
har-0.1.0 spec/spec_helper.rb