-
Notifications
You must be signed in to change notification settings - Fork 3
/
Guardfile
37 lines (29 loc) · 1.14 KB
/
Guardfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require 'guard/rspec/dsl'
debugger_gem = %w(pry-byebug pry-debugger).detect do |gem|
`bundle show #{gem} 2>&1 >/dev/null`
$?.success?
end
debugger_require = debugger_gem ? " --require #{debugger_gem}" : nil
guard :rspec, all_on_start: true,
all_after_pass: true,
cmd: "bundle exec rspec --format progress#{debugger_require}" do
dsl = Guard::RSpec::Dsl.new(self)
rspec, ruby = dsl.rspec, dsl.ruby
# RSpec files
watch('.rspec') { rspec.spec_dir }
watch rspec.spec_helper { rspec.spec_dir }
watch rspec.spec_support { rspec.spec_dir }
watch(%r{^spec/support}) { rspec.spec_dir } # This should not be necessary.
watch rspec.spec_files
# Run all specs when a matcher changes.
watch('spec/matchers.rb') { 'spec' }
# Run all specs when a shared spec changes.
watch(%r{^spec/.+_sharedspec\.rb$}) { rspec.spec_dir }
# Run all specs when a fixture changes.
watch(%r{^spec/fixtures}) { rspec.spec_dir }
# Run all specs when the bundle changes.
watch('Gemfile.lock') { rspec.spec_dir }
watch(%r{^(.+)\.gemspec$}) { rspec.spec_dir }
# Ruby files
dsl.watch_spec_files_for ruby.lib_files
end