Sha256: f5af86a4eedbd1b45eacb33c445468ec24353c741a82d54148b5853e2ea16dfb

Contents?: true

Size: 793 Bytes

Versions: 19

Compression:

Stored size: 793 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'hx'
require 'ostruct'
require 'rspec'
begin
require 'rubygems'
rescue LoadError
end

class FakeInput
  include Hx::Filter

  def initialize
    @entries = {}
  end

  def add_entry(path, content, metadata={})
    entry = metadata.dup
    entry['content'] = content
    @entries[path] = entry
  end

  def each_entry_path(selector)
    @entries.each_key { |path| yield path if selector.accept_path? path }
    self
  end

  def get_entry(path)
    begin
      @entries.fetch(path)
    rescue IndexError
      raise Hx::NoSuchEntryError, path
    end  
  end
end

RSpec::Matchers.define :accept_path do |value|
  match do |acceptor|
    acceptor.accept_path?(value)
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
hx-0.26.1 spec/spec_helper.rb
hx-0.26.0 spec/spec_helper.rb
hx-0.25.0 spec/spec_helper.rb
hx-0.24.0 spec/spec_helper.rb
hx-0.23.0 spec/spec_helper.rb
hx-0.22.0 spec/spec_helper.rb
hx-0.21.0 spec/spec_helper.rb
hx-0.20.0 spec/spec_helper.rb
hx-0.19.0 spec/spec_helper.rb
hx-0.18.0 spec/spec_helper.rb
hx-0.17.0 spec/spec_helper.rb
hx-0.16.0 spec/spec_helper.rb
hx-0.15.0 spec/spec_helper.rb
hx-0.14.0 spec/spec_helper.rb
hx-0.13.0 spec/spec_helper.rb
hx-0.12.0 spec/spec_helper.rb
hx-0.11.0 spec/spec_helper.rb
hx-0.10.0 spec/spec_helper.rb
hx-0.9.0 spec/spec_helper.rb