Sha256: a709839fcbd31f194e1ace590f02af37a4b07f5976f6e8798e55dd602ecf9a0b

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'
module Polygon
  describe Entry, 'ancestors_or_self' do

    subject{ entry.ancestors_or_self(filter) }

    context 'when a normal entry in root' do
      let(:filter){ false }
      let(:entry){ Entry.new(Path.dir, Path.here % Path.dir) }
      it "should contain all index files" do
        expected = entry.index_files.map{|index|
          Entry.new(Path.dir, index)
        } + [ entry ]
        subject.should eq(expected)
      end
    end

    context 'when filtered' do
      let(:filter){ true }
      let(:entry){ Entry.new(Path.dir, Path.here % Path.dir) }
      it "should contain only existing files" do
        subject.should eq([ entry ])
      end
    end

    context 'when the root and not filtered' do
      let(:filter){ false }
      let(:entry){ Entry.new(Path.dir, 'index.yml') }
      it "should be the singleton" do
        subject.should eq([entry])
      end
    end

    context 'when the root and filtered' do
      let(:filter){ true }
      let(:entry){ Entry.new(Path.dir, "index.yml") }
      it "should be empty" do
        subject.should eq([])
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polygon-0.10.1 spec/entry/test_ancestors_or_self.rb
polygon-0.10.0 spec/entry/test_ancestors_or_self.rb
polygon-0.9.1 spec/entry/test_ancestors_or_self.rb