diff options
author | Josh Frye <joshfng@gmail.com> | 2016-02-01 10:50:55 -0500 |
---|---|---|
committer | Josh Frye <joshfng@gmail.com> | 2016-02-01 10:50:55 -0500 |
commit | fe43c48b33758d54505840584fdc7682bf9baed4 (patch) | |
tree | 24f56bf8d7199a55350649578b0ad1f15d1af525 /Guardfile | |
parent | da8e0f86595299740a344309cb5963854b61c4a6 (diff) | |
download | gitlab-ce-fe43c48b33758d54505840584fdc7682bf9baed4.tar.gz |
Add Guard to run rspec on file change.add-guard-rspec
Diffstat (limited to 'Guardfile')
-rw-r--r-- | Guardfile | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Guardfile b/Guardfile new file mode 100644 index 00000000000..bac445cffd2 --- /dev/null +++ b/Guardfile @@ -0,0 +1,36 @@ +guard :rspec, cmd: "bundle exec rspec" do + require "guard/rspec/dsl" + dsl = Guard::RSpec::Dsl.new(self) + + # Feel free to open issues for suggestions and improvements + + # RSpec files + rspec = dsl.rspec + watch(rspec.spec_helper) { rspec.spec_dir } + watch(rspec.spec_support) { rspec.spec_dir } + watch(rspec.spec_files) + + # Ruby files + ruby = dsl.ruby + dsl.watch_spec_files_for(ruby.lib_files) + + # Rails files + rails = dsl.rails(view_extensions: %w(erb haml slim)) + dsl.watch_spec_files_for(rails.app_files) + dsl.watch_spec_files_for(rails.views) + + watch(rails.controllers) do |m| + [ + rspec.spec.("routing/#{m[1]}_routing"), + rspec.spec.("controllers/#{m[1]}_controller"), + rspec.spec.("acceptance/#{m[1]}") + ] + end + + # Rails config changes + watch(rails.spec_helper) { rspec.spec_dir } + watch(rails.routes) { "#{rspec.spec_dir}/routing" } + watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" } + + ignore! /tmp/ +end |