Sha256: 4d0b3a86b9cde59f939a036c89712065021cea0c8014208d8a481eedd6969df0

Contents?: true

Size: 842 Bytes

Versions: 2

Compression:

Stored size: 842 Bytes

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'hx'
require 'ostruct'
require 'spec'
require 'spec/autorun'
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 }
    self
  end

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

Spec::Matchers.define :accept do |value|
  match do |acceptor|
    acceptor.accept?(value)
  end
end

Spec::Runner.configure do |config|
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hx-0.8.3 spec/spec_helper.rb
hx-0.8.2 spec/spec_helper.rb