Skip to content

Instantly share code, notes, and snippets.

@trevor-vaughan
Created April 18, 2015 01:50
Show Gist options
  • Save trevor-vaughan/10d66c0a3db718fb5e7b to your computer and use it in GitHub Desktop.
Save trevor-vaughan/10d66c0a3db718fb5e7b to your computer and use it in GitHub Desktop.
spec_helper.rb snippet for custom environments in rspec-puppet tests.
require 'puppetlabs_spec_helper/module_spec_helper'
def set_environment(environment = :production)
RSpec.configure { |config| config.default_facts['environment'] = environment.to_s }
end
RSpec.configure do |config|
config.before(:each) do
if defined?(environment)
set_environment(environment)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment