Sha256: 832a6be43f34aaed6eb7efdc4c5188d8d4fd403aa1abb9760e033e96898c4459

Contents?: true

Size: 1.25 KB

Versions: 82

Compression:

Stored size: 1.25 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
          SpecInfra::Configuration.instance_variable_set("@#{c}", value)
        end
      end
    end
  end
end

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
specinfra-1.27.5 lib/specinfra/helper/configuration.rb
specinfra-1.27.4 lib/specinfra/helper/configuration.rb
specinfra-1.27.3 lib/specinfra/helper/configuration.rb
specinfra-1.27.2 lib/specinfra/helper/configuration.rb
specinfra-1.27.1 lib/specinfra/helper/configuration.rb
specinfra-1.27.0 lib/specinfra/helper/configuration.rb
specinfra-1.26.0 lib/specinfra/helper/configuration.rb
specinfra-1.25.8 lib/specinfra/helper/configuration.rb
specinfra-1.25.7 lib/specinfra/helper/configuration.rb
specinfra-1.25.6 lib/specinfra/helper/configuration.rb
specinfra-1.25.5 lib/specinfra/helper/configuration.rb
specinfra-1.25.4 lib/specinfra/helper/configuration.rb
specinfra-1.25.3 lib/specinfra/helper/configuration.rb
specinfra-1.25.2 lib/specinfra/helper/configuration.rb
specinfra-1.25.1 lib/specinfra/helper/configuration.rb
specinfra-1.25.0 lib/specinfra/helper/configuration.rb
specinfra-1.24.0 lib/specinfra/helper/configuration.rb
specinfra-1.23.1 lib/specinfra/helper/configuration.rb
specinfra-1.23.0 lib/specinfra/helper/configuration.rb
specinfra-1.22.1 lib/specinfra/helper/configuration.rb