Sha256: 12a80d3d51fd45ce318174cd0a4948c590febf68600f8e03ca6e13a0f7dfae7c

Contents?: true

Size: 860 Bytes

Versions: 5

Compression:

Stored size: 860 Bytes

Contents

module Guard
  class RSpec
    module Options
      DEFAULTS = {
          all_on_start:    false,
          all_after_pass:  false,
          run_all:         { message: 'Running all specs' },
          failed_mode:     :focus,  # :keep and :none are other posibilities
          spec_paths:      %w[spec],
          cmd:             'rspec',
          launchy:         nil,
          notification:    true
      }

      class << self
        def with_defaults(options = {})
          _deep_merge(DEFAULTS, options)
        end

        private

        def _deep_merge(hash1, hash2)
          hash1.merge(hash2) do |key, oldval, newval|
            if oldval.instance_of?(Hash) && newval.instance_of?(Hash)
              _deep_merge(oldval, newval)
            else
              newval
            end
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
guard-rspec-4.2.10 lib/guard/rspec/options.rb
guard-rspec-4.2.9 lib/guard/rspec/options.rb
guard-rspec-4.2.8 lib/guard/rspec/options.rb
guard-rspec-4.2.7 lib/guard/rspec/options.rb
guard-rspec-4.2.6 lib/guard/rspec/options.rb