Sha256: 0c520fcc6a12eea56c50665c3a9faa235fd0825768ea8bf868b1de49f62f00cf

Contents?: true

Size: 832 Bytes

Versions: 1

Compression:

Stored size: 832 Bytes

Contents

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

describe Barometer::KeyFileParser do
  include FakeFS::SpecHelpers

  it "returns the the KEY for the given path" do
    FakeFS do
      FileUtils.mkdir("~")
      File.open(Barometer::KEY_FILE, 'w') {|f| f << "\weather_bug:\n  code: ABC123" }
      Barometer::KeyFileParser.find(:weather_bug, :code).should == "ABC123"
    end
  end

  it "returns nil when the key does not exist" do
    FakeFS do
      FileUtils.mkdir("~")
      File.open(Barometer::KEY_FILE, 'w') {|f| f << "\weather_bug:\n" }
      Barometer::KeyFileParser.find(:weather_bug, :code).should be_nil
    end
  end

  it "returns nil when the file does not exist" do
    FakeFS do
      FileUtils.mkdir("~")
      Barometer::KeyFileParser.find(:weather_bug, :code).should be_nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
barometer-0.8.0 spec/key_file_parser_spec.rb