Sha256: a1c950f1f0d7f3f8bdfd4573efb101219e5c135bbc4c1e0e7e8270394644f463

Contents?: true

Size: 862 Bytes

Versions: 18

Compression:

Stored size: 862 Bytes

Contents

require 'guard'
require 'guard/plugin'

module Guard
  class RSpec < Plugin
    require 'guard/rspec/options'
    require 'guard/rspec/deprecator'
    require 'guard/rspec/runner'

    attr_accessor :options, :runner

    def initialize(options = {})
      super
      @options = Options.with_defaults(options)
      Deprecator.warns_about_deprecated_options(@options)
      @runner = Runner.new(@options)
    end

    def start
      ::Guard::UI.info 'Guard::RSpec is running'
      run_all if options[:all_on_start]
    end

    def run_all
      _throw_if_failed { runner.run_all }
    end

    def reload
      runner.reload
    end

    def run_on_modifications(paths)
      return false if paths.empty?
      _throw_if_failed { runner.run(paths) }
    end

    private

    def _throw_if_failed
      throw :task_has_failed unless yield
    end
  end
end

Version data entries

18 entries across 16 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/guard-rspec-4.3.1/lib/guard/rspec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/guard-rspec-4.3.1/lib/guard/rspec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/guard-rspec-4.3.1/lib/guard/rspec.rb
guard-rspec-4.3.1 lib/guard/rspec.rb
guard-rspec-4.3.0 lib/guard/rspec.rb
guard-rspec-4.2.10 lib/guard/rspec.rb
guard-rspec-4.2.9 lib/guard/rspec.rb
guard-rspec-4.2.8 lib/guard/rspec.rb
guard-rspec-4.2.7 lib/guard/rspec.rb
guard-rspec-4.2.6 lib/guard/rspec.rb
guard-rspec-4.2.5 lib/guard/rspec.rb
guard-rspec-4.2.4 lib/guard/rspec.rb
guard-rspec-4.2.3 lib/guard/rspec.rb
guard-rspec-4.2.2 lib/guard/rspec.rb
guard-rspec-4.2.1 lib/guard/rspec.rb
guard-rspec-4.2.0 lib/guard/rspec.rb
guard-rspec-4.1.1 lib/guard/rspec.rb
guard-rspec-4.1.0 lib/guard/rspec.rb