Skip to content

Commit 708f951

Browse files
committed
Enable Guard
1 parent 7002747 commit 708f951

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ group :development do
5151
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
5252
gem 'spring'
5353
gem 'spring-watcher-listen', '~> 2.0.0'
54+
gem 'spring-commands-rspec'
5455
gem 'ronn'
56+
gem 'guard-rspec', require: false
5557
end
5658

5759
group :test do

Gemfile.lock

+33
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ GEM
3939
byebug (10.0.0)
4040
case_transform (0.2)
4141
activesupport
42+
coderay (1.1.2)
4243
concurrent-ruby (1.0.5)
4344
config (1.7.0)
4445
activesupport (>= 3.0)
@@ -95,6 +96,7 @@ GEM
9596
fast_gettext (1.6.0)
9697
ffaker (2.8.1)
9798
ffi (1.9.21)
99+
formatador (0.2.5)
98100
fuubar (2.3.1)
99101
rspec-core (~> 3.0)
100102
ruby-progressbar (~> 1.4)
@@ -104,6 +106,20 @@ GEM
104106
gettext_i18n_rails (1.8.0)
105107
fast_gettext (>= 0.9.0)
106108
gettext_test_log (0.2.1)
109+
guard (2.14.2)
110+
formatador (>= 0.2.4)
111+
listen (>= 2.7, < 4.0)
112+
lumberjack (>= 1.0.12, < 2.0)
113+
nenv (~> 0.1)
114+
notiffany (~> 0.0)
115+
pry (>= 0.9.12)
116+
shellany (~> 0.0)
117+
thor (>= 0.18.1)
118+
guard-compat (1.2.1)
119+
guard-rspec (4.7.3)
120+
guard (~> 2.1)
121+
guard-compat (~> 1.1)
122+
rspec (>= 2.99.0, < 4.0)
107123
hashdiff (0.3.7)
108124
hpricot (0.8.6)
109125
i18n (0.9.5)
@@ -119,18 +135,26 @@ GEM
119135
loofah (2.2.0)
120136
crass (~> 1.0.2)
121137
nokogiri (>= 1.5.9)
138+
lumberjack (1.0.12)
122139
memory_profiler (0.9.9)
123140
method_source (0.9.0)
124141
mini_portile2 (2.3.0)
125142
minitest (5.11.3)
126143
mustache (1.0.5)
127144
mysql2 (0.4.10)
145+
nenv (0.3.0)
128146
nokogiri (1.8.2)
129147
mini_portile2 (~> 2.3.0)
148+
notiffany (0.1.1)
149+
nenv (~> 0.1)
150+
shellany (~> 0.0)
130151
parallel (1.12.1)
131152
parser (2.4.0.2)
132153
ast (~> 2.3)
133154
powerpack (0.1.1)
155+
pry (0.11.3)
156+
coderay (~> 1.1.0)
157+
method_source (~> 0.9.0)
134158
public_suffix (3.0.2)
135159
puma (3.10.0)
136160
rack (2.0.4)
@@ -160,6 +184,10 @@ GEM
160184
hpricot (>= 0.8.2)
161185
mustache (>= 0.7.0)
162186
rdiscount (>= 1.5.8)
187+
rspec (3.7.0)
188+
rspec-core (~> 3.7.0)
189+
rspec-expectations (~> 3.7.0)
190+
rspec-mocks (~> 3.7.0)
163191
rspec-core (3.7.1)
164192
rspec-support (~> 3.7.0)
165193
rspec-expectations (3.7.0)
@@ -198,6 +226,7 @@ GEM
198226
rubocop (= 0.52.1)
199227
rubocop-rspec (= 1.19)
200228
sexp_processor (4.10.0)
229+
shellany (0.0.1)
201230
shoulda-matchers (3.1.2)
202231
activesupport (>= 4.0.0)
203232
simplecov (0.14.1)
@@ -207,6 +236,8 @@ GEM
207236
simplecov-html (0.10.2)
208237
spring (2.0.2)
209238
activesupport (>= 4.2)
239+
spring-commands-rspec (1.0.4)
240+
spring (>= 0.9.1)
210241
spring-watcher-listen (2.0.1)
211242
listen (>= 2.7, < 4.0)
212243
spring (>= 1.2, < 3.0)
@@ -257,6 +288,7 @@ DEPENDENCIES
257288
gettext
258289
gettext_i18n_rails
259290
gettext_test_log
291+
guard-rspec
260292
listen (>= 3.0.5, < 3.2)
261293
memory_profiler
262294
mysql2 (~> 0.4.10)
@@ -272,6 +304,7 @@ DEPENDENCIES
272304
shoulda-matchers
273305
simplecov
274306
spring
307+
spring-commands-rspec
275308
spring-watcher-listen (~> 2.0.0)
276309
terminal-table (~> 1.8)
277310
thor

Guardfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
guard :rspec, cmd: 'bin/rspec' do
2+
require 'guard/rspec/dsl'
3+
dsl = Guard::RSpec::Dsl.new(self)
4+
5+
# Feel free to open issues for suggestions and improvements
6+
7+
# RSpec files
8+
rspec = dsl.rspec
9+
watch(rspec.spec_helper) { rspec.spec_dir }
10+
watch(rspec.spec_support) { rspec.spec_dir }
11+
watch(rspec.spec_files)
12+
13+
# Ruby files
14+
ruby = dsl.ruby
15+
dsl.watch_spec_files_for(ruby.lib_files)
16+
17+
# Rails files
18+
rails = dsl.rails(view_extensions: %w[erb haml slim])
19+
dsl.watch_spec_files_for(rails.app_files)
20+
dsl.watch_spec_files_for(rails.views)
21+
22+
watch(rails.controllers) do |m|
23+
[
24+
rspec.spec.call("routing/#{m[1]}_routing"),
25+
rspec.spec.call("controllers/#{m[1]}_controller"),
26+
rspec.spec.call("acceptance/#{m[1]}")
27+
]
28+
end
29+
30+
# Rails config changes
31+
watch(rails.spec_helper) { rspec.spec_dir }
32+
watch(rails.routes) { "#{rspec.spec_dir}/routing" }
33+
watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" }
34+
end

bin/rspec

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env ruby
2+
begin
3+
load File.expand_path('../spring', __FILE__)
4+
rescue LoadError => e
5+
raise unless e.message.include?('spring')
6+
end
27
# frozen_string_literal: true
38

49
#

0 commit comments

Comments
 (0)