Sha256: e347673dddc3466e3fdd16a17a956b2734da4a8f3fca13f4c34adc40bf82d0c3

Contents?: true

Size: 1.07 KB

Versions: 22

Compression:

Stored size: 1.07 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

require 'hx'

describe Hx::Overlay do
  before(:each) do
    @a = FakeInput.new
    @a.add_entry('foo', 'foo:A')
    @a.add_entry('bar', 'bar:A')
    @b = FakeInput.new
    @b.add_entry('bar', 'bar:B')
    @b.add_entry('baz', 'baz:B')
    @overlay = Hx::Overlay.new(@a, @b)
  end

  it "should return itself from each_entry" do
    @overlay.each_entry(Hx::Path::ALL) {}.should == @overlay
  end

  it "should expose the union of paths" do
    actual_paths = []
    @overlay.each_entry(Hx::Path::ALL) do |path, entry|
      actual_paths << path
    end
    actual_paths.sort.should == %w(foo bar baz).sort
  end

  it "should give earlier sources precedence" do
    @overlay.each_entry(Hx::Path::ALL) do |path, entry|
      entry.should == @a.get_entry('bar') if path == 'bar'
    end
  end

  it "should expose entries from all sources" do
    @overlay.each_entry(Hx::Path::ALL) do |path, entry|
      entry.should == @a.get_entry('foo') if path == 'foo'
      entry.should == @b.get_entry('baz') if path == 'baz'
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

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