/cronenberg_config_spec.rb Secret
Last active
January 18, 2016 20:34
-
-
Save Papierkorb/320e3902343abc380136 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
require 'cronenberg/config' | |
describe Cronenberg::Config do | |
context "#initialize" do | |
let(:config_hash) do | |
{ | |
host: 'vsphere.pizza.com', | |
user: 'pizzamaster5000', | |
password: 'pizzapass', | |
} | |
end | |
context "with no env variables or config file" do | |
it "raises a Runtime error" do | |
expect{ Cronenberg::Config.new }.to raise_error(RuntimeError) | |
end | |
end | |
context "with a valid configuration hash" do | |
before do | |
expect(Cronenberg::Config).to receive(:process_environment_variables).and_return config_hash | |
end | |
it "returns the configuration hash" do | |
# WARNING !!! | |
# This test does not make sense. You're infact testing RSpec here, as the only thing you do is calling | |
# the method you mocked above. No real point in doing this. Only left here as an example! | |
expect(Cronenberg::Config.process_environment_variables).to eq config_hash | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment