Skip to content

Instantly share code, notes, and snippets.

@Papierkorb
Forked from big-samantha/cronenberg__config_spec.rb
Last active January 18, 2016 20:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Papierkorb/320e3902343abc380136 to your computer and use it in GitHub Desktop.
Save Papierkorb/320e3902343abc380136 to your computer and use it in GitHub Desktop.
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