Sha256: af24f5607e8ee1c804139d17d4b3f253f88d88bb340b21c39aabf472fd14c140

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 Bytes

Contents

require "spec_helper"

module RockConfig
  describe Manager do
    let(:configuration) { Configuration.new }

    it "returns config if found" do
      result = mock("Config")
      result.should_receive(:send).with("development") { "yay" }

      scanner = mock("Scanner")
      scanner.should_receive(:new) .with(configuration) { scanner }
      scanner.should_receive(:find).with("sample")      { result }

      manager         = Manager.new(configuration, scanner)
      manager_result  = manager.fetch "sample", "development"

      manager_result.should eq("yay")
    end

    it "returns nul if config not found" do
      scanner = mock("Scanner")
      scanner.should_receive(:new) .with(configuration) { scanner }
      scanner.should_receive(:find).with("sample")      { nil }

      manager = Manager.new(configuration, scanner)

      manager.fetch("sample", "development").should be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rock_config-0.0.1 spec/manager_spec.rb