Sha256: f587e8709853ddf7cd3cfad306a9bac0e9fa6814a16a4be37039bf1dac4f91fd

Contents?: true

Size: 724 Bytes

Versions: 8

Compression:

Stored size: 724 Bytes

Contents

module SpecInfra
  module Configuration
    class << self
      VALID_OPTIONS_KEYS = [:path, :pre_command, :stdout, :stderr, :sudo_path, :pass_prompt].freeze

      def defaults
        VALID_OPTIONS_KEYS.inject({}) { |o, k| o.merge!(k => send(k)) }
      end

      def method_missing(meth, val=nil)
        key = meth.to_s
        key.gsub!(/=$/, '')
        if val
          instance_variable_set("@#{key}", val)
          RSpec.configuration.send(:"#{key}=", val) if defined?(RSpec)
        end

        ret = instance_variable_get("@#{key}")
        if ret.nil? && defined?(RSpec) && RSpec.configuration.respond_to?(key)
          ret = RSpec.configuration.send(key)
        end
        ret
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
specinfra-0.0.11 lib/specinfra/configuration.rb
specinfra-0.0.10 lib/specinfra/configuration.rb
specinfra-0.0.9 lib/specinfra/configuration.rb
specinfra-0.0.8 lib/specinfra/configuration.rb
specinfra-0.0.7 lib/specinfra/configuration.rb
specinfra-0.0.6 lib/specinfra/configuration.rb
specinfra-0.0.5 lib/specinfra/configuration.rb
specinfra-0.0.4 lib/specinfra/configuration.rb