1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- ## Uncomment and set this to only include directories you want to watch
5
- # directories %w(app lib config test spec features)
6
-
7
- ## Uncomment to clear the screen before every task
8
- # clearing :on
9
-
10
- ## Guard internally checks for changes in the Guardfile and exits.
11
- ## If you want Guard to automatically start up again, run guard in a
12
- ## shell loop, e.g.:
13
- ##
14
- ## $ while bundle exec guard; do echo "Restarting Guard..."; done
15
- ##
16
- ## Note: if you are using the `directories` clause above and you are not
17
- ## watching the project directory ('.'), then you will want to move
18
- ## the Guardfile to a watched dir and symlink it back, e.g.
19
- #
20
- # $ mkdir config
21
- # $ mv Guardfile config/
22
- # $ ln -s config/Guardfile .
23
- #
24
- # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
25
-
26
- # Note: The cmd option is now required due to the increasing number of ways
27
- # rspec may be run, below are examples of the most common uses.
28
- # * bundler: 'bundle exec rspec'
29
- # * bundler binstubs: 'bin/rspec'
30
- # * spring: 'bin/rspec' (This will use spring if running and you have
31
- # installed the spring binstubs per the docs)
32
- # * zeus: 'zeus rspec' (requires the server to be started separately)
33
- # * 'just' rspec: 'rspec'
34
-
35
1
guard :rspec , cmd : "bundle exec rspec --color" do
36
2
require "guard/rspec/dsl"
37
3
dsl = Guard ::RSpec ::Dsl . new ( self )
38
4
39
- # Feel free to open issues for suggestions and improvements
40
-
41
5
# RSpec files
42
6
rspec = dsl . rspec
43
7
watch ( rspec . spec_helper ) { rspec . spec_dir }
@@ -47,31 +11,4 @@ guard :rspec, cmd: "bundle exec rspec --color" do
47
11
# Ruby files
48
12
ruby = dsl . ruby
49
13
dsl . watch_spec_files_for ( ruby . lib_files )
50
-
51
- # Rails files
52
- rails = dsl . rails ( view_extensions : %w( erb haml slim ) )
53
- dsl . watch_spec_files_for ( rails . app_files )
54
- dsl . watch_spec_files_for ( rails . views )
55
-
56
- watch ( rails . controllers ) do |m |
57
- [
58
- rspec . spec . ( "routing/#{ m [ 1 ] } _routing" ) ,
59
- rspec . spec . ( "controllers/#{ m [ 1 ] } _controller" ) ,
60
- rspec . spec . ( "acceptance/#{ m [ 1 ] } " )
61
- ]
62
- end
63
-
64
- # Rails config changes
65
- watch ( rails . spec_helper ) { rspec . spec_dir }
66
- watch ( rails . routes ) { "#{ rspec . spec_dir } /routing" }
67
- watch ( rails . app_controller ) { "#{ rspec . spec_dir } /controllers" }
68
-
69
- # Capybara features specs
70
- watch ( rails . view_dirs ) { |m | rspec . spec . ( "features/#{ m [ 1 ] } " ) }
71
-
72
- # Turnip features and steps
73
- watch ( %r{^spec/acceptance/(.+)\. feature$} )
74
- watch ( %r{^spec/acceptance/steps/(.+)_steps\. rb$} ) do |m |
75
- Dir [ File . join ( "**/#{ m [ 1 ] } .feature" ) ] [ 0 ] || "spec/acceptance"
76
- end
77
14
end
0 commit comments