Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • guard-org/guard
1 result
Show changes
Commits on Source (38)
Showing
with 148 additions and 116 deletions
Loading
Loading
@@ -6,6 +6,7 @@ inherit_from:
AllCops:
TargetRubyVersion: 2.2
Exclude:
- vendor/**/*
- db/schema.rb
- tmp/aruba/Guardfile
- tmp/aruba/Gemfile
Loading
Loading
Loading
Loading
@@ -59,7 +59,7 @@ Style/NumericPredicate:
 
# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceInsideArrayPercentLiteral:
Layout/SpaceInsideArrayPercentLiteral:
Exclude:
- 'guard.gemspec'
 
Loading
Loading
@@ -67,7 +67,7 @@ Style/SpaceInsideArrayPercentLiteral:
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceInsideStringInterpolation:
Layout/SpaceInsideStringInterpolation:
Exclude:
- 'lib/guard.rb'
- 'lib/guard/cli.rb'
Loading
Loading
# frozen_string_literal: true
source "https://rubygems.org"
 
gemspec unless ENV["USE_INSTALLED_GUARD"] == "1"
Loading
Loading
@@ -15,13 +17,13 @@ group :development do
# on HoundCI's side.
#
# See https://github.com/houndci/hound/issues/1250
gem "rubocop", "0.51.0", require: false
gem "rubocop", "0.54.0", require: false
 
gem "guard-rubocop", require: false
 
gem "yard", require: false, platform: :mri
gem "redcarpet", require: false, platform: :mri
gem "guard-ronn", require: false, platform: :mri
gem "redcarpet", require: false, platform: :mri
gem "yard", require: false, platform: :mri
 
# Used for release
gem "gems", require: false, platform: :mri
Loading
Loading
@@ -37,19 +39,19 @@ group :test do
gem "guard-cucumber", "~> 2.1", require: false
gem "guard-rspec", require: false
 
gem "codeclimate-test-reporter", require: nil
gem "rspec", ">= 3.0.0", require: false
gem "aruba", "~> 0.9", require: false
gem "codeclimate-test-reporter", require: nil
gem "notiffany", ">= 0.0.6", require: false
gem "rspec", ">= 3.0.0", require: false
end
 
# Needed for Travis
# See http://docs.travis-ci.com/user/languages/ruby/#Rubinius
#
platforms :rbx do
gem "racc"
gem "rubysl", "~> 2.0"
gem "psych"
gem "json"
gem "psych"
gem "racc"
gem "rubinius-coverage"
gem "rubysl", "~> 2.0"
end
Loading
Loading
@@ -4,7 +4,7 @@
 
:exclamation: Guard is currently accepting more maintainers. Please [read this](https://github.com/guard/guard/wiki/Maintainers) if you're interested in joining the team.
 
[![Gem Version](https://img.shields.io/gem/v/guard.svg?style=flat)](https://rubygems.org/gems/guard) [![Build Status](https://travis-ci.org/guard/guard.svg?branch=master)](https://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.svg)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/github/guard/guard/badges/gpa.svg)](https://codeclimate.com/github/guard/guard) [![Test Coverage](https://codeclimate.com/github/guard/guard/badges/coverage.svg)](https://codeclimate.com/github/guard/guard) [![Inline docs](http://inch-ci.org/github/guard/guard.svg)](http://inch-ci.org/github/guard/guard)
[![Gem Version](https://img.shields.io/gem/v/guard.svg?style=flat)](https://rubygems.org/gems/guard) [![Build Status](https://travis-ci.org/guard/guard.svg?branch=master)](https://travis-ci.org/guard/guard) [![Dependency Status](https://gemnasium.com/guard/guard.svg)](https://gemnasium.com/guard/guard) [![Code Climate](https://codeclimate.com/github/guard/guard/badges/gpa.svg)](https://codeclimate.com/github/guard/guard) [![Test Coverage](https://codeclimate.com/github/guard/guard/badges/coverage.svg)](https://codeclimate.com/github/guard/guard) [![Inline docs](http://inch-ci.org/github/guard/guard.svg)](http://inch-ci.org/github/guard/guard) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com)
 
<img src="http://f.cl.ly/items/0A0M3W2x3I1P450z341U/guard-Icon.png" alt="Guard Icon" align="right" />
Guard automates various tasks by running custom rules whenever file or directories are modified.
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@ group :specs, halt_on_fail: true do
# watch(%r{^lib/guard/(guard|plugin).rb$}) { "spec/guard/plugin" }
end
 
guard :rubocop, all_on_start: false, cli: "--rails" do
guard :rubocop, all_on_start: false, cli: "--rails -c .rubocop.yml" do
watch(%r{.+\.rb$}) { |m| m[0] }
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
end
Loading
Loading
Loading
Loading
@@ -33,5 +33,5 @@ Before do
set_environment_variable "HOME", home
FileUtils.mkdir(home)
 
@aruba_timeout_seconds = Cucumber::JRUBY ? 35 : 15
@aruba_timeout_seconds = Cucumber::JRUBY ? 45 : 15
end
Loading
Loading
@@ -276,11 +276,10 @@ module Guard
#
def _prompt(ending_char)
proc do |target_self, nest_level, pry|
history = pry.input_array.size
process = Guard.listener.paused? ? "pause" : "guard"
level = ":#{ nest_level }" unless nest_level.zero?
 
"[#{ history }] #{ _scope_for_prompt }#{ process }"\
"[#{ _history(pry) }] #{ _scope_for_prompt }#{ process }"\
"(#{ _clip_name(target_self) })#{ level }#{ ending_char } "
end
end
Loading
Loading
@@ -288,6 +287,15 @@ module Guard
def _clip_name(target)
Pry.view_clip(target)
end
def _history(pry)
# https://github.com/pry/pry/blob/5bf2585d0a49a4a3666a9eae80ee31153e3ffcf4/CHANGELOG.md#v0120-november-5-2018
if Gem::Version.new(Pry::VERSION) < Gem::Version.new("0.12.0")
return pry.input_array.size
end
pry.input_ring.size
end
end
end
end
module Guard
VERSION = "2.14.2"
VERSION = "2.15.0"
end
path = File.expand_path("../../../../bin/guard", __FILE__)
# frozen_string_literal: true
path = File.expand_path("../../../bin/guard", __dir__)
load path
 
RSpec.describe GuardReloader do
Loading
Loading
@@ -11,13 +13,13 @@ RSpec.describe GuardReloader do
before do
allow(described_class::Config).to receive(:new).and_return(config)
 
allow(config).to receive(:current_bundler_gemfile).
and_return(bundle_gemfile_env)
allow(config).to receive(:current_bundler_gemfile)
.and_return(bundle_gemfile_env)
 
allow(config).to receive(:using_bundler?).and_return(bundle_gemfile_env)
allow(config).to receive(:guard_core_path).and_return(guard_core_path)
 
allow(config).to receive(:program_arguments).and_return(%w(foo bar baz))
allow(config).to receive(:program_arguments).and_return(%w[foo bar baz])
allow(config).to receive(:using_rubygems?).and_return(rubygems_deps_env)
allow(config).to receive(:program_path).and_return(program_path)
end
Loading
Loading
@@ -54,8 +56,8 @@ RSpec.describe GuardReloader do
 
context "when the relative Gemfile exists" do
before do
allow(config).to receive(:exist?).
with(Pathname("/my/project/Gemfile")).and_return(true)
allow(config).to receive(:exist?)
.with(Pathname("/my/project/Gemfile")).and_return(true)
 
allow(config).to receive(:setup_bundler)
allow(config).to receive(:setup_bundler_env)
Loading
Loading
@@ -67,19 +69,19 @@ RSpec.describe GuardReloader do
end
 
it "sets the Gemfile" do
expect(config).to receive(:setup_bundler_env).
with("/my/project/Gemfile")
expect(config).to receive(:setup_bundler_env)
.with("/my/project/Gemfile")
subject.setup
end
end
 
context "when the relative Gemfile does not exist" do
before do
allow(config).to receive(:exist?).
with(Pathname("/my/project/Gemfile")).and_return(false)
allow(config).to receive(:exist?)
.with(Pathname("/my/project/Gemfile")).and_return(false)
 
allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(false)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))
.and_return(false)
end
 
it "does not setup bundler" do
Loading
Loading
@@ -110,8 +112,8 @@ RSpec.describe GuardReloader do
 
context "when Gemfile exists" do
before do
allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(true)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))
.and_return(true)
end
 
it "shows a warning" do
Loading
Loading
@@ -122,8 +124,8 @@ RSpec.describe GuardReloader do
 
context "when no Gemfile exists" do
before do
allow(config).to receive(:exist?).with(Pathname("Gemfile")).
and_return(false)
allow(config).to receive(:exist?).with(Pathname("Gemfile"))
.and_return(false)
end
 
it "shows no warning" do
Loading
Loading
# frozen_string_literal: true
require "guard/cli/environments/bundler"
 
# TODO: instead of shared examples, use have_received if possible
Loading
Loading
@@ -22,8 +24,8 @@ RSpec.describe Guard::Cli::Environments::Bundler do
allow(ENV).to receive(:[]).with("BUNDLE_GEMFILE").and_return(gemfile)
allow(ENV).to receive(:[]).with("RUBYGEMS_GEMDEPS").and_return(gemdeps)
 
allow(File).to receive(:exist?).with("Gemfile").
and_return(gemfile_present)
allow(File).to receive(:exist?).with("Gemfile")
.and_return(gemfile_present)
 
subject.verify
end
Loading
Loading
# frozen_string_literal: true
require "guard/cli/environments/evaluate_only"
 
RSpec.describe Guard::Cli::Environments::EvaluateOnly do
Loading
Loading
@@ -35,11 +37,11 @@ RSpec.describe Guard::Cli::Environments::EvaluateOnly do
 
it "passes options to evaluator" do
evaluator_options = double("evaluator_options")
allow(session).to receive(:evaluator_options).
and_return(evaluator_options)
allow(session).to receive(:evaluator_options)
.and_return(evaluator_options)
 
expect(Guard::Guardfile::Evaluator).to receive(:new).
with(evaluator_options).and_return(evaluator)
expect(Guard::Guardfile::Evaluator).to receive(:new)
.with(evaluator_options).and_return(evaluator)
 
subject.evaluate
end
Loading
Loading
@@ -52,8 +54,8 @@ RSpec.describe Guard::Cli::Environments::EvaluateOnly do
].each do |error_class|
context "when a #{error_class} error occurs" do
before do
allow(Guard).to receive(:init).
and_raise(error_class, "#{error_class} error!")
allow(Guard).to receive(:init)
.and_raise(error_class, "#{error_class} error!")
end
 
it "aborts" do
Loading
Loading
# frozen_string_literal: true
require "guard/cli/environments/valid"
require "guard/cli/environments/bundler"
 
Loading
Loading
@@ -14,8 +16,8 @@ RSpec.describe Guard::Cli::Environments::Valid do
let(:bundler) { instance_double("Guard::Cli::Environments::Bundler") }
 
before do
allow(Guard::Cli::Environments::Bundler).to receive(:new).
and_return(bundler)
allow(Guard::Cli::Environments::Bundler).to receive(:new)
.and_return(bundler)
 
allow(bundler).to receive(:verify)
end
Loading
Loading
@@ -24,8 +26,8 @@ RSpec.describe Guard::Cli::Environments::Valid do
before do
allow(bundler).to receive(:verify)
 
allow(options).to receive(:[]).with(:no_bundler_warning).
and_return(false)
allow(options).to receive(:[]).with(:no_bundler_warning)
.and_return(false)
end
 
it "starts guard" do
Loading
Loading
@@ -52,8 +54,8 @@ RSpec.describe Guard::Cli::Environments::Valid do
].each do |error_class|
context "when a #{error_class} error occurs" do
before do
allow(Guard).to receive(:start).
and_raise(error_class, "#{error_class} error!")
allow(Guard).to receive(:start)
.and_raise(error_class, "#{error_class} error!")
end
 
it "aborts" do
Loading
Loading
@@ -150,8 +152,8 @@ RSpec.describe Guard::Cli::Environments::Valid do
end
 
it "Only creates the Guardfile without initializing any Guard template" do
allow(evaluator).to receive(:evaluate).
and_raise(Guard::Guardfile::Evaluator::NoGuardfileError)
allow(evaluator).to receive(:evaluate)
.and_raise(Guard::Guardfile::Evaluator::NoGuardfileError)
 
allow(File).to receive(:exist?).with("Gemfile").and_return(false)
expect(generator).to receive(:create_guardfile)
Loading
Loading
@@ -178,12 +180,12 @@ RSpec.describe Guard::Cli::Environments::Valid do
end
 
it "creates a Guardfile" do
expect(evaluator).to receive(:evaluate).
and_raise(Guard::Guardfile::Evaluator::NoGuardfileError).once
expect(evaluator).to receive(:evaluate)
.and_raise(Guard::Guardfile::Evaluator::NoGuardfileError).once
expect(evaluator).to receive(:evaluate)
 
expect(Guard::Guardfile::Generator).to receive(:new).
and_return(generator)
expect(Guard::Guardfile::Generator).to receive(:new)
.and_return(generator)
expect(generator).to receive(:create_guardfile)
 
subject.initialize_guardfile
Loading
Loading
@@ -203,30 +205,30 @@ RSpec.describe Guard::Cli::Environments::Valid do
expect(generator).to receive(:initialize_template).with("rspec")
expect(generator).to receive(:initialize_template).with("pow")
 
subject.initialize_guardfile(%w(rspec pow))
subject.initialize_guardfile(%w[rspec pow])
end
 
context "when passed a guard name" do
context "when the Guardfile is empty" do
before do
allow(evaluator).to receive(:evaluate).
and_raise Guard::Guardfile::Evaluator::NoPluginsError
allow(evaluator).to receive(:evaluate)
.and_raise Guard::Guardfile::Evaluator::NoPluginsError
allow(generator).to receive(:initialize_template)
end
 
it "works without without errors" do
expect(subject.initialize_guardfile(%w(rspec))).to be_zero
expect(subject.initialize_guardfile(%w[rspec])).to be_zero
end
 
it "adds the template" do
expect(generator).to receive(:initialize_template).with("rspec")
subject.initialize_guardfile(%w(rspec))
subject.initialize_guardfile(%w[rspec])
end
end
 
it "initializes the template of the passed Guard" do
expect(generator).to receive(:initialize_template).with("rspec")
subject.initialize_guardfile(%w(rspec))
subject.initialize_guardfile(%w[rspec])
end
end
 
Loading
Loading
@@ -236,8 +238,8 @@ RSpec.describe Guard::Cli::Environments::Valid do
 
context "when passed an unknown guard name" do
before do
expect(generator).to receive(:initialize_template).with("foo").
and_raise(Guard::Guardfile::Generator::NoSuchPlugin, "foo")
expect(generator).to receive(:initialize_template).with("foo")
.and_raise(Guard::Guardfile::Generator::NoSuchPlugin, "foo")
end
 
it "returns an exit code" do
Loading
Loading
@@ -245,7 +247,7 @@ RSpec.describe Guard::Cli::Environments::Valid do
"Could not load 'guard/foo' or '~/.guard/templates/foo'"\
" or find class Guard::Foo\n"
)
expect(subject.initialize_guardfile(%w(foo))).to be(1)
expect(subject.initialize_guardfile(%w[foo])).to be(1)
end
end
end
Loading
Loading
# frozen_string_literal: true
require "guard/cli"
 
RSpec.describe Guard::CLI do
Loading
Loading
@@ -11,14 +13,14 @@ RSpec.describe Guard::CLI do
before do
@options = {}
allow(subject).to receive(:options).and_return(@options)
allow(::Guard::DslDescriber).to receive(:new).with(no_args).
and_return(dsl_describer)
allow(::Guard::DslDescriber).to receive(:new).with(no_args)
.and_return(dsl_describer)
 
allow(Guard::Cli::Environments::EvaluateOnly).to receive(:new).
and_return(bare_environment)
allow(Guard::Cli::Environments::EvaluateOnly).to receive(:new)
.and_return(bare_environment)
 
allow(Guard::Cli::Environments::Valid).to receive(:new).
and_return(valid_environment)
allow(Guard::Cli::Environments::Valid).to receive(:new)
.and_return(valid_environment)
end
 
describe "#start" do
Loading
Loading
@@ -49,8 +51,8 @@ RSpec.describe Guard::CLI do
it "passes options" do
pending "needs JRuby support first" if defined?(JRUBY_VERSION)
 
expect(Guard::Cli::Environments::Valid).to receive(:new).with(@options).
and_return(valid_environment)
expect(Guard::Cli::Environments::Valid).to receive(:new).with(@options)
.and_return(valid_environment)
begin
subject.start
rescue SystemExit
Loading
Loading
@@ -99,8 +101,8 @@ RSpec.describe Guard::CLI do
 
describe "#init" do
before do
allow(Guard::Cli::Environments::Valid).to receive(:new).
and_return(valid_environment)
allow(Guard::Cli::Environments::Valid).to receive(:new)
.and_return(valid_environment)
allow(valid_environment).to receive(:initialize_guardfile).and_return(0)
end
 
Loading
Loading
@@ -119,8 +121,8 @@ RSpec.describe Guard::CLI do
end
 
it "passes options" do
expect(Guard::Cli::Environments::Valid).to receive(:new).with(@options).
and_return(valid_environment)
expect(Guard::Cli::Environments::Valid).to receive(:new).with(@options)
.and_return(valid_environment)
begin
subject.init
rescue SystemExit
Loading
Loading
# frozen_string_literal: true
require "guard/commander"
 
RSpec.describe Guard::Commander do
Loading
Loading
@@ -33,7 +35,7 @@ RSpec.describe Guard::Commander do
# from stop()
allow(Guard).to receive(:setup)
allow(Guard).to receive(:listener).and_return(listener)
allow(session).to receive(:watchdirs).and_return(%w(dir1 dir2))
allow(session).to receive(:watchdirs).and_return(%w[dir1 dir2])
allow(Guard).to receive(:interactor).and_return(interactor)
 
# Simulate Ctrl-D in Pry, or Ctrl-C in non-interactive mode
Loading
Loading
@@ -49,8 +51,8 @@ RSpec.describe Guard::Commander do
end
 
it "displays an info message" do
expect(Guard::UI).to receive(:info).
with("Guard is now watching at 'dir1', 'dir2'")
expect(Guard::UI).to receive(:info)
.with("Guard is now watching at 'dir1', 'dir2'")
 
Guard.start
end
Loading
Loading
@@ -205,8 +207,8 @@ RSpec.describe Guard::Commander do
 
context "with invalid parameter" do
it "raises an ArgumentError" do
expect { Guard.pause(:invalid) }.
to raise_error(ArgumentError, "invalid mode: :invalid")
expect { Guard.pause(:invalid) }
.to raise_error(ArgumentError, "invalid mode: :invalid")
end
end
end
Loading
Loading
@@ -249,8 +251,8 @@ RSpec.describe Guard::Commander do
 
context "with invalid parameter" do
it "raises an ArgumentError" do
expect { Guard.pause(:invalid) }.
to raise_error(ArgumentError, "invalid mode: :invalid")
expect { Guard.pause(:invalid) }
.to raise_error(ArgumentError, "invalid mode: :invalid")
end
end
end
Loading
Loading
@@ -260,8 +262,8 @@ RSpec.describe Guard::Commander do
let(:dsl_describer) { instance_double("Guard::DslDescriber") }
 
before do
allow(Guard::DslDescriber).to receive(:new).with(no_args).
and_return(dsl_describer)
allow(Guard::DslDescriber).to receive(:new).with(no_args)
.and_return(dsl_describer)
end
 
it "shows list of plugins" do
Loading
Loading
# frozen_string_literal: true
require "guard/plugin"
 
require "guard/commands/all"
Loading
Loading
@@ -14,13 +16,12 @@ RSpec.describe Guard::Commands::All do
let(:session) { instance_double("Guard::Internals::Session") }
 
class FakePry < Pry::Command
def self.output
end
def self.output; end
end
 
before do
allow(session).to receive(:convert_scope).with(given_scope).
and_return(converted_scope)
allow(session).to receive(:convert_scope).with(given_scope)
.and_return(converted_scope)
 
allow(state).to receive(:session).and_return(session)
allow(Guard).to receive(:state).and_return(state)
Loading
Loading
@@ -38,8 +39,8 @@ RSpec.describe Guard::Commands::All do
let(:converted_scope) { [{ groups: [], plugins: [] }, []] }
 
it "runs the :run_all action" do
expect(Guard).to receive(:async_queue_add).
with([:guard_run_all, groups: [], plugins: []])
expect(Guard).to receive(:async_queue_add)
.with([:guard_run_all, groups: [], plugins: []])
 
FakePry.process
end
Loading
Loading
@@ -50,8 +51,8 @@ RSpec.describe Guard::Commands::All do
let(:converted_scope) { [{ groups: [foo_group], plugins: [] }, []] }
 
it "runs the :run_all action with the given scope" do
expect(Guard).to receive(:async_queue_add).
with([:guard_run_all, groups: [foo_group], plugins: []])
expect(Guard).to receive(:async_queue_add)
.with([:guard_run_all, groups: [foo_group], plugins: []])
 
FakePry.process("foo")
end
Loading
Loading
@@ -62,8 +63,8 @@ RSpec.describe Guard::Commands::All do
let(:converted_scope) { [{ groups: [], plugins: [bar_guard] }, []] }
 
it "runs the :run_all action with the given scope" do
expect(Guard).to receive(:async_queue_add).
with([:guard_run_all, plugins: [bar_guard], groups: []])
expect(Guard).to receive(:async_queue_add)
.with([:guard_run_all, plugins: [bar_guard], groups: []])
 
FakePry.process("bar")
end
Loading
Loading
# frozen_string_literal: true
require "guard/commands/change"
 
RSpec.describe Guard::Commands::Change do
let(:output) { instance_double(Pry::Output) }
 
class FakePry < Pry::Command
def self.output
end
def self.output; end
end
 
before do
Loading
Loading
@@ -19,8 +20,8 @@ RSpec.describe Guard::Commands::Change do
 
context "with a file" do
it "runs the :run_on_changes action with the given file" do
expect(::Guard).to receive(:async_queue_add).
with(modified: ["foo"], added: [], removed: [])
expect(::Guard).to receive(:async_queue_add)
.with(modified: ["foo"], added: [], removed: [])
 
FakePry.process("foo")
end
Loading
Loading
@@ -28,8 +29,8 @@ RSpec.describe Guard::Commands::Change do
 
context "with multiple files" do
it "runs the :run_on_changes action with the given files" do
expect(::Guard).to receive(:async_queue_add).
with(modified: %w(foo bar baz), added: [], removed: [])
expect(::Guard).to receive(:async_queue_add)
.with(modified: %w[foo bar baz], added: [], removed: [])
 
FakePry.process("foo", "bar", "baz")
end
Loading
Loading
# frozen_string_literal: true
require "guard/commands/notification"
 
RSpec.describe Guard::Commands::Notification do
Loading
Loading
@@ -9,8 +11,8 @@ RSpec.describe Guard::Commands::Notification do
 
before do
allow(FakePry).to receive(:output).and_return(output)
allow(Pry::Commands).to receive(:create_command).
with("notification") do |&block|
allow(Pry::Commands).to receive(:create_command)
.with("notification") do |&block|
FakePry.instance_eval(&block)
end
 
Loading
Loading
# frozen_string_literal: true
require "guard/commands/pause"
 
RSpec.describe Guard::Commands::Pause do
class FakePry < Pry::Command
def self.output
end
def self.output; end
end
 
before do
Loading
Loading
# frozen_string_literal: true
require "guard/commands/reload"
 
require "guard/internals/session"
Loading
Loading
@@ -17,8 +19,8 @@ RSpec.describe Guard::Commands::Reload do
end
 
before do
allow(session).to receive(:convert_scope).with(given_scope).
and_return(converted_scope)
allow(session).to receive(:convert_scope).with(given_scope)
.and_return(converted_scope)
 
allow(state).to receive(:session).and_return(session)
allow(Guard).to receive(:state).and_return(state)
Loading
Loading
@@ -36,8 +38,8 @@ RSpec.describe Guard::Commands::Reload do
let(:converted_scope) { [{ groups: [], plugins: [] }, []] }
 
it "triggers the :reload action" do
expect(Guard).to receive(:async_queue_add).
with([:guard_reload, { groups: [], plugins: [] }])
expect(Guard).to receive(:async_queue_add)
.with([:guard_reload, { groups: [], plugins: [] }])
FakePry.process
end
end
Loading
Loading
@@ -47,8 +49,8 @@ RSpec.describe Guard::Commands::Reload do
let(:converted_scope) { [{ groups: [foo_group], plugins: [] }, []] }
 
it "triggers the :reload action with the given scope" do
expect(Guard).to receive(:async_queue_add).
with([:guard_reload, { groups: [foo_group], plugins: [] }])
expect(Guard).to receive(:async_queue_add)
.with([:guard_reload, { groups: [foo_group], plugins: [] }])
FakePry.process("foo")
end
end
Loading
Loading
@@ -58,8 +60,8 @@ RSpec.describe Guard::Commands::Reload do
let(:converted_scope) { [{ groups: [], plugins: [bar_guard] }, []] }
 
it "triggers the :reload action with the given scope" do
expect(Guard).to receive(:async_queue_add).
with([:guard_reload, { plugins: [bar_guard], groups: [] }])
expect(Guard).to receive(:async_queue_add)
.with([:guard_reload, { plugins: [bar_guard], groups: [] }])
FakePry.process("bar")
end
end
Loading
Loading
# frozen_string_literal: true
require "guard/commands/scope"
 
require "guard/internals/session"
Loading
Loading
@@ -18,8 +20,8 @@ RSpec.describe Guard::Commands::Scope do
end
 
before do
allow(session).to receive(:convert_scope).with(given_scope).
and_return(converted_scope)
allow(session).to receive(:convert_scope).with(given_scope)
.and_return(converted_scope)
 
allow(state).to receive(:session).and_return(session)
allow(Guard).to receive(:state).and_return(state)
Loading
Loading
@@ -51,8 +53,8 @@ RSpec.describe Guard::Commands::Scope do
let(:converted_scope) { [{ groups: [foo_group], plugins: [] }, []] }
 
it "sets up the scope with the given scope" do
expect(scope).to receive(:from_interactor).
with(groups: [foo_group], plugins: [])
expect(scope).to receive(:from_interactor)
.with(groups: [foo_group], plugins: [])
FakePry.process("foo")
end
end
Loading
Loading
@@ -62,8 +64,8 @@ RSpec.describe Guard::Commands::Scope do
let(:converted_scope) { [{ groups: [], plugins: [bar_guard] }, []] }
 
it "runs the :scope= action with the given scope" do
expect(scope).to receive(:from_interactor).
with(plugins: [bar_guard], groups: [])
expect(scope).to receive(:from_interactor)
.with(plugins: [bar_guard], groups: [])
FakePry.process("bar")
end
end
Loading
Loading