summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Frye <joshfng@gmail.com>2016-02-01 10:50:55 -0500
committerJosh Frye <joshfng@gmail.com>2016-02-01 10:50:55 -0500
commitfe43c48b33758d54505840584fdc7682bf9baed4 (patch)
tree24f56bf8d7199a55350649578b0ad1f15d1af525
parentda8e0f86595299740a344309cb5963854b61c4a6 (diff)
downloadgitlab-ce-add-guard-rspec.tar.gz
Add Guard to run rspec on file change.add-guard-rspec
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock21
-rw-r--r--Guardfile36
3 files changed, 59 insertions, 0 deletions
diff --git a/Gemfile b/Gemfile
index a09d44f8bfd..2af6cc4a7fe 100644
--- a/Gemfile
+++ b/Gemfile
@@ -236,6 +236,8 @@ group :development do
gem 'rblineprof', platform: :mri, require: false
gem 'web-console', '~> 2.0'
+ gem 'guard-rspec', require: false
+
# Better errors handler
gem 'better_errors', '~> 1.0.1'
gem 'binding_of_caller', '~> 0.7.2'
diff --git a/Gemfile.lock b/Gemfile.lock
index ec92964df25..b35d84bf669 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -396,6 +396,20 @@ GEM
grape-entity (0.4.8)
activesupport
multi_json (>= 1.3.2)
+ guard (2.13.0)
+ formatador (>= 0.2.4)
+ listen (>= 2.7, <= 4.0)
+ lumberjack (~> 1.0)
+ nenv (~> 0.1)
+ notiffany (~> 0.0)
+ pry (>= 0.9.12)
+ shellany (~> 0.0)
+ thor (>= 0.18.1)
+ guard-compat (1.2.1)
+ guard-rspec (4.6.4)
+ guard (~> 2.1)
+ guard-compat (~> 1.1)
+ rspec (>= 2.99.0, < 4.0)
haml (4.0.7)
tilt
haml-rails (0.9.0)
@@ -459,6 +473,7 @@ GEM
rb-inotify (>= 0.9)
loofah (2.0.3)
nokogiri (>= 1.5.9)
+ lumberjack (1.0.10)
macaddr (1.7.1)
systemu (~> 2.6.2)
mail (2.6.3)
@@ -474,6 +489,7 @@ GEM
multi_xml (0.5.5)
multipart-post (2.0.0)
mysql2 (0.3.20)
+ nenv (0.2.0)
nested_form (0.3.2)
net-ldap (0.12.1)
net-ssh (3.0.1)
@@ -484,6 +500,9 @@ GEM
newrelic_rpm (3.9.4.245)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
+ notiffany (0.0.8)
+ nenv (~> 0.1)
+ shellany (~> 0.0)
nprogress-rails (0.1.6.7)
oauth (0.4.7)
oauth2 (1.0.0)
@@ -731,6 +750,7 @@ GEM
sexp_processor (4.6.0)
sham_rack (1.3.6)
rack
+ shellany (0.0.1)
shoulda-matchers (2.8.0)
activesupport (>= 3.0.0)
sidekiq (4.0.1)
@@ -941,6 +961,7 @@ DEPENDENCIES
gon (~> 6.0.1)
grape (~> 0.13.0)
grape-entity (~> 0.4.2)
+ guard-rspec
haml-rails (~> 0.9.0)
hipchat (~> 1.5.0)
html-pipeline (~> 1.11.0)
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