diff --git a/Gemfile b/Gemfile index 93cf7e2..c3aa756 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,9 @@ group :development, :test do # rspec gem "rspec-rails", "3.3.1" + # guard + gem "guard-rspec", require: false + # GUID generation gem "uuid", "2.3.8" diff --git a/Gemfile.lock b/Gemfile.lock index 5d8068b..c456053 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -50,6 +50,8 @@ GEM builder (3.2.2) byebug (4.0.5) columnize (= 0.9.0) + celluloid (0.16.0) + timers (~> 4.0.0) codeclimate-test-reporter (0.4.7) simplecov (>= 0.7.1, < 1.0.0) coderay (1.1.0) @@ -62,16 +64,37 @@ GEM factory_girl_rails (4.5.0) factory_girl (~> 4.5.0) railties (>= 3.0.0) + ffi (1.9.8) fixture_builder (0.4.1) activerecord (>= 2) activesupport (>= 2) + formatador (0.2.5) fuubar (2.0.0) rspec (~> 3.0) ruby-progressbar (~> 1.4) globalid (0.3.5) activesupport (>= 4.1.0) + guard (2.12.6) + formatador (>= 0.2.4) + listen (~> 2.7) + 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.5.2) + guard (~> 2.1) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + hitimes (1.2.2) i18n (0.7.0) json (1.8.3) + listen (2.10.1) + celluloid (~> 0.16.0) + rb-fsevent (>= 0.9.3) + rb-inotify (>= 0.9) little-plugger (1.1.3) logging (2.0.0) little-plugger (~> 1.1) @@ -80,6 +103,7 @@ GEM logging (>= 1.8) loofah (2.0.2) nokogiri (>= 1.5.9) + lumberjack (1.0.9) macaddr (1.7.1) systemu (~> 2.6.2) mail (2.6.3) @@ -89,8 +113,12 @@ GEM mini_portile (0.6.2) minitest (5.7.0) multi_json (1.11.1) + nenv (0.2.0) nokogiri (1.6.6.2) mini_portile (~> 0.6.0) + notiffany (0.0.6) + nenv (~> 0.1) + shellany (~> 0.0) nyan-cat-formatter (0.11) rspec (>= 2.99, >= 2.14.2, < 4) parser (2.2.2.5) @@ -134,6 +162,9 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (2.0.0) rake (10.4.2) + rb-fsevent (0.9.5) + rb-inotify (0.9.5) + ffi (>= 0.5.0) rspec (3.3.0) rspec-core (~> 3.3.0) rspec-expectations (~> 3.3.0) @@ -164,6 +195,7 @@ GEM rainbow (>= 1.99.1, < 3.0) ruby-progressbar (~> 1.4) ruby-progressbar (1.7.5) + shellany (0.0.1) simplecov (0.10.0) docile (~> 1.1.0) json (~> 1.8) @@ -182,6 +214,8 @@ GEM systemu (2.6.5) thor (0.19.1) thread_safe (0.3.5) + timers (4.0.1) + hitimes tzinfo (1.2.2) thread_safe (~> 0.1) uuid (2.3.8) @@ -197,6 +231,7 @@ DEPENDENCIES factory_girl_rails (= 4.5.0) fixture_builder (= 0.4.1) fuubar (= 2.0.0) + guard-rspec logging-rails (= 0.5.0) nyan-cat-formatter pry diff --git a/Guardfile b/Guardfile new file mode 100644 index 0000000..fbb648f --- /dev/null +++ b/Guardfile @@ -0,0 +1,30 @@ +guard :rspec, cmd: "NO_COVERAGE=true bin/rspec" do + require "guard/rspec/dsl" + dsl = Guard::RSpec::Dsl.new(self) + + # 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 + dsl.watch_spec_files_for(rails.app_files) + + watch(rails.controllers) do |m| + [ + # rspec.spec.call("routing/#{m[1]}_routing"), + rspec.spec.call("controllers/#{m[1]}_controller") + ] + 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" } +end diff --git a/bin/guard b/bin/guard new file mode 100755 index 0000000..0c1a532 --- /dev/null +++ b/bin/guard @@ -0,0 +1,16 @@ +#!/usr/bin/env ruby +# +# This file was generated by Bundler. +# +# The application 'guard' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'pathname' +ENV['BUNDLE_GEMFILE'] ||= File.expand_path("../../Gemfile", + Pathname.new(__FILE__).realpath) + +require 'rubygems' +require 'bundler/setup' + +load Gem.bin_path('guard', 'guard')