Sha256: 0ac73541fd38bae596c9dee8e6bca4cd328fb56597756224e0a2641008cff0b2

Contents?: true

Size: 1.34 KB

Versions: 71

Compression:

Stored size: 1.34 KB

Contents

module Specinfra
  module Helper
    module Configuration
      def subject
        example = RSpec.respond_to?(:current_example) ? RSpec.current_example : self.example
        example.metadata[:subject] = described_class
        build_configurations
        super
      end

      # 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.
      #
      # @example
      #
      #   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
      def build_configurations
        Specinfra::Configuration.defaults.keys.each do |c|
          if self.respond_to?(c.to_sym)
            value = self.send(c)
          else
            value = RSpec.configuration.send(c) if defined?(RSpec)
          end
          next if c == :lxc && defined?(Serverspec::Type::Lxc) && value.is_a?(Serverspec::Type::Lxc)
          Specinfra::Configuration.instance_variable_set("@#{c}", value)
        end
      end
    end
  end
end

Version data entries

71 entries across 71 versions & 1 rubygems

Version Path
specinfra-2.91.0 lib/specinfra/helper/configuration.rb
specinfra-2.90.1 lib/specinfra/helper/configuration.rb
specinfra-2.90.0 lib/specinfra/helper/configuration.rb
specinfra-2.89.0 lib/specinfra/helper/configuration.rb
specinfra-2.88.2 lib/specinfra/helper/configuration.rb
specinfra-2.88.1 lib/specinfra/helper/configuration.rb
specinfra-2.88.0 lib/specinfra/helper/configuration.rb
specinfra-2.87.2 lib/specinfra/helper/configuration.rb
specinfra-2.87.1 lib/specinfra/helper/configuration.rb
specinfra-2.87.0 lib/specinfra/helper/configuration.rb
specinfra-2.86.0 lib/specinfra/helper/configuration.rb
specinfra-2.85.1 lib/specinfra/helper/configuration.rb
specinfra-2.85.0 lib/specinfra/helper/configuration.rb
specinfra-2.84.1 lib/specinfra/helper/configuration.rb
specinfra-2.84.0 lib/specinfra/helper/configuration.rb
specinfra-2.83.4 lib/specinfra/helper/configuration.rb
specinfra-2.83.3 lib/specinfra/helper/configuration.rb
specinfra-2.83.2 lib/specinfra/helper/configuration.rb
specinfra-2.83.1 lib/specinfra/helper/configuration.rb
specinfra-2.83.0 lib/specinfra/helper/configuration.rb