Sha256: 2e73c0dd9458c336bab08261bba526dfbd2feae8d60036e623bb4bbc59387a8f

Contents?: true

Size: 990 Bytes

Versions: 15

Compression:

Stored size: 990 Bytes

Contents

require "guard/compat/plugin"

require "guard/rspec/options"
require "guard/rspec/deprecator"
require "guard/rspec/runner"

# NOTE: To avoid 'superclass mismatch for class RSpec' errors,
# every file has to have
#
#   class RSpec < Plugin
#
# and not just
#
#   class RSpec

module Guard
  class RSpec < Plugin
    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
      Compat::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

15 entries across 15 versions & 6 rubygems

Version Path
honeybadger-5.4.0 vendor/bundle/ruby/3.2.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
honeybadger-5.3.0 vendor/bundle/ruby/3.2.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
honeybadger-4.5.3 vendor/bundle/ruby/2.6.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
alimentos-alu0100945645-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
alimentos-alu0100945645-1.0.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
comiditaULL-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
comidita_ull-0.1.1 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
comidita_ull-0.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
gameboard-3.1.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
gameboard-3.0.0 vendor/bundle/ruby/2.3.0/gems/guard-rspec-4.7.3/lib/guard/rspec.rb
guard-rspec-4.7.3 lib/guard/rspec.rb
guard-rspec-4.7.2 lib/guard/rspec.rb
guard-rspec-4.7.1 lib/guard/rspec.rb
guard-rspec-4.7.0 lib/guard/rspec.rb
guard-rspec-4.6.5 lib/guard/rspec.rb