Module: Serverspec::Helper::Configuration

Defined in:
lib/serverspec/helper/configuration.rb

Instance Method Summary collapse

Instance Method Details

#build_configurationsObject

You can create a set of configurations provided to all specs in your spec_helper:

RSpec.configure { |c| c.pre_command = "source ~/.zshrc" }

Any configurations you provide with ‘let(:option_name)` in a spec will automatically be merged on top of the configurations.

Examples:


describe 'Gem' do
  let(:pre_command) { "source ~/.zshrc" }

  %w(pry awesome_print bundler).each do |p|
    describe package(p) do
      it { should be_installed.by('gem') }
    end
  end
end


27
28
29
30
31
32
33
# File 'lib/serverspec/helper/configuration.rb', line 27

def build_configurations
  Serverspec::Configuration.defaults.keys.each do |c|
    value = self.respond_to?(c.to_sym) ?
    self.send(c) : RSpec.configuration.send(c)
    Serverspec::Configuration.send(:"#{c}=", value)
  end
end

#subjectObject



4
5
6
7
# File 'lib/serverspec/helper/configuration.rb', line 4

def subject
  build_configurations
  super
end