Sha256: 9edf5fd783a90cc74f2ef8e88dc7f6a78678d274621698f7b91545b19f8dcd51

Contents?: true

Size: 1.42 KB

Versions: 1

Compression:

Stored size: 1.42 KB

Contents

module NameQ
  describe Directory do
    let(:path) { "/path/to/somewhere" }
    let(:subject) { described_class.new(path) }

    it "is a kind of pool" do
      expect(subject).to be_a NameQ::Support::Pool
    end

    context "internals" do
      context "underlying list" do
        let(:list) { instance_double(NameQ::Support::List) }
        let(:result) { subject.instance_variable_get("@list") }

        it "builds the right kind of list by default" do
          expect(NameQ::Support::List).to receive(:new).with(case_sensitive: true).and_return list
          expect(result).to eq list
        end

        context "case-insensitive" do
          let(:subject) { described_class.new(path, case_sensitive: false) }

          it "builds the right kind of list by default" do
            expect(NameQ::Support::List).to receive(:new).with(case_sensitive: false).and_return list
            expect(result).to eq list
          end
        end

        context "refresh" do
          let(:path) { File.expand_path(".") }
          let(:items) { result.send(:all) }

          it "has a block that does the right stuff" do
            expect(items).to include("nameq.gemspec", "Gemfile", "Rakefile")
          end
        end
      end

      describe "#entry_factory" do
        it "has a special filename entry factory" do
          expect(subject.send(:entry_factory)).to eq NameQ::Support::FilenameEntry
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nameq-0.0.3 spec/directory_spec.rb