Sha256: 965ff5b81050fd19d8a719f3fa1d797e8d380ac8a7dede4075e0332f4f7d25f3
Contents?: true
Size: 1.48 KB
Versions: 1
Compression:
Stored size: 1.48 KB
Contents
require 'spec_helper' require 'settings_file' describe HipChatSecrets::SettingsFile do context "with a valid config" do subject do HipChatSecrets::SettingsFile.new File.join(File.dirname(__FILE__), '../fixtures/hipchatConfig.json') end it "uses the fixture config" do subject.email.should eq 'test@pass.com' end it "can find a settings file" do subject.send(:find_configs).should be_a_kind_of Array subject.send(:find_configs,'~/a_file_that_shouldnt_exist').should be_a_kind_of Array end it "exposes the raw config" do subject.config.should be_a_kind_of Hash end it "exposes the config_file's path" do subject.config_file.should be_a_kind_of String end it "can pass missing method calls to the config hash" do subject.email.should be_a_kind_of String subject.password.should be_a_kind_of String end end context "with an invalid config" do subject do HipChatSecrets::SettingsFile.new File.join(File.dirname(__FILE__), '../fixtures/hipchatConfigBad.json') end it "aborts when the password is missing" do expect { subject }.to raise_error /'password' key is missing!/ end end context "with a malformed config" do subject do HipChatSecrets::SettingsFile.new File.join(File.dirname(__FILE__), '../fixtures/hipchatConfigMalformed.json') end it "aborts when the config is garbage" do expect { subject }.to raise_error JSON::ParserError end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hipchat-secrets-0.9.1 | spec/lib/settings_file_spec.rb |