mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Add guard-rspec to automate running tests with the command: bundle exec guard
This commit is contained in:
parent
6b31fa9115
commit
6a435fa570
4 changed files with 109 additions and 0 deletions
1
Gemfile
1
Gemfile
|
|
@ -76,6 +76,7 @@ group :development do
|
||||||
gem 'bullet'
|
gem 'bullet'
|
||||||
gem 'erb_lint', require: false
|
gem 'erb_lint', require: false
|
||||||
gem 'erblint-github'
|
gem 'erblint-github'
|
||||||
|
gem 'guard-rspec', require: false
|
||||||
gem 'listen', '~> 3.0.5'
|
gem 'listen', '~> 3.0.5'
|
||||||
gem 'nested_scaffold'
|
gem 'nested_scaffold'
|
||||||
# gem 'reek', require: false
|
# gem 'reek', require: false
|
||||||
|
|
|
||||||
30
Gemfile.lock
30
Gemfile.lock
|
|
@ -109,6 +109,7 @@ GEM
|
||||||
rack-test (>= 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
regexp_parser (>= 1.5, < 3.0)
|
regexp_parser (>= 1.5, < 3.0)
|
||||||
xpath (~> 3.2)
|
xpath (~> 3.2)
|
||||||
|
coderay (1.1.3)
|
||||||
concurrent-ruby (1.2.2)
|
concurrent-ruby (1.2.2)
|
||||||
crass (1.0.6)
|
crass (1.0.6)
|
||||||
cssbundling-rails (1.1.2)
|
cssbundling-rails (1.1.2)
|
||||||
|
|
@ -149,10 +150,25 @@ GEM
|
||||||
factory_bot (~> 6.2.0)
|
factory_bot (~> 6.2.0)
|
||||||
railties (>= 5.0.0)
|
railties (>= 5.0.0)
|
||||||
ffi (1.15.5)
|
ffi (1.15.5)
|
||||||
|
formatador (1.1.0)
|
||||||
friendly_id (5.1.0)
|
friendly_id (5.1.0)
|
||||||
activerecord (>= 4.0.0)
|
activerecord (>= 4.0.0)
|
||||||
globalid (1.1.0)
|
globalid (1.1.0)
|
||||||
activesupport (>= 5.0)
|
activesupport (>= 5.0)
|
||||||
|
guard (2.18.0)
|
||||||
|
formatador (>= 0.2.4)
|
||||||
|
listen (>= 2.7, < 4.0)
|
||||||
|
lumberjack (>= 1.0.12, < 2.0)
|
||||||
|
nenv (~> 0.1)
|
||||||
|
notiffany (~> 0.0)
|
||||||
|
pry (>= 0.13.0)
|
||||||
|
shellany (~> 0.0)
|
||||||
|
thor (>= 0.18.1)
|
||||||
|
guard-compat (1.2.1)
|
||||||
|
guard-rspec (4.7.3)
|
||||||
|
guard (~> 2.1)
|
||||||
|
guard-compat (~> 1.1)
|
||||||
|
rspec (>= 2.99.0, < 4.0)
|
||||||
haml (6.1.1)
|
haml (6.1.1)
|
||||||
temple (>= 0.8.2)
|
temple (>= 0.8.2)
|
||||||
thor
|
thor
|
||||||
|
|
@ -189,6 +205,7 @@ GEM
|
||||||
loofah (2.19.1)
|
loofah (2.19.1)
|
||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
|
lumberjack (1.2.8)
|
||||||
mail (2.8.1)
|
mail (2.8.1)
|
||||||
mini_mime (>= 0.1.1)
|
mini_mime (>= 0.1.1)
|
||||||
net-imap
|
net-imap
|
||||||
|
|
@ -201,6 +218,7 @@ GEM
|
||||||
minitest (5.18.0)
|
minitest (5.18.0)
|
||||||
msgpack (1.6.0)
|
msgpack (1.6.0)
|
||||||
multi_json (1.15.0)
|
multi_json (1.15.0)
|
||||||
|
nenv (0.3.0)
|
||||||
nested_scaffold (1.1.0)
|
nested_scaffold (1.1.0)
|
||||||
net-imap (0.3.4)
|
net-imap (0.3.4)
|
||||||
date
|
date
|
||||||
|
|
@ -220,6 +238,9 @@ GEM
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
nokogiri (1.14.2-x86_64-linux)
|
nokogiri (1.14.2-x86_64-linux)
|
||||||
racc (~> 1.4)
|
racc (~> 1.4)
|
||||||
|
notiffany (0.1.3)
|
||||||
|
nenv (~> 0.1)
|
||||||
|
shellany (~> 0.0)
|
||||||
omniauth (2.1.1)
|
omniauth (2.1.1)
|
||||||
hashie (>= 3.4.6)
|
hashie (>= 3.4.6)
|
||||||
rack (>= 2.2.3)
|
rack (>= 2.2.3)
|
||||||
|
|
@ -231,6 +252,9 @@ GEM
|
||||||
parser (3.2.1.0)
|
parser (3.2.1.0)
|
||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
pg (1.4.5)
|
pg (1.4.5)
|
||||||
|
pry (0.14.2)
|
||||||
|
coderay (~> 1.1)
|
||||||
|
method_source (~> 1.0)
|
||||||
public_suffix (5.0.1)
|
public_suffix (5.0.1)
|
||||||
puma (6.1.0)
|
puma (6.1.0)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
|
|
@ -291,6 +315,10 @@ GEM
|
||||||
reverse_markdown (2.1.1)
|
reverse_markdown (2.1.1)
|
||||||
nokogiri
|
nokogiri
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
|
rspec (3.12.0)
|
||||||
|
rspec-core (~> 3.12.0)
|
||||||
|
rspec-expectations (~> 3.12.0)
|
||||||
|
rspec-mocks (~> 3.12.0)
|
||||||
rspec-core (3.12.1)
|
rspec-core (3.12.1)
|
||||||
rspec-support (~> 3.12.0)
|
rspec-support (~> 3.12.0)
|
||||||
rspec-expectations (3.12.2)
|
rspec-expectations (3.12.2)
|
||||||
|
|
@ -332,6 +360,7 @@ GEM
|
||||||
rexml (~> 3.2, >= 3.2.5)
|
rexml (~> 3.2, >= 3.2.5)
|
||||||
rubyzip (>= 1.2.2, < 3.0)
|
rubyzip (>= 1.2.2, < 3.0)
|
||||||
websocket (~> 1.0)
|
websocket (~> 1.0)
|
||||||
|
shellany (0.0.1)
|
||||||
simplecov (0.22.0)
|
simplecov (0.22.0)
|
||||||
docile (~> 1.1)
|
docile (~> 1.1)
|
||||||
simplecov-html (~> 0.11)
|
simplecov-html (~> 0.11)
|
||||||
|
|
@ -433,6 +462,7 @@ DEPENDENCIES
|
||||||
erblint-github
|
erblint-github
|
||||||
factory_bot_rails
|
factory_bot_rails
|
||||||
friendly_id (~> 5.1.0)
|
friendly_id (~> 5.1.0)
|
||||||
|
guard-rspec
|
||||||
haml
|
haml
|
||||||
jbuilder (~> 2.5)
|
jbuilder (~> 2.5)
|
||||||
jquery-rails
|
jquery-rails
|
||||||
|
|
|
||||||
70
Guardfile
Normal file
70
Guardfile
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
# A sample Guardfile
|
||||||
|
# More info at https://github.com/guard/guard#readme
|
||||||
|
|
||||||
|
## Uncomment and set this to only include directories you want to watch
|
||||||
|
# directories %w(app lib config test spec features) \
|
||||||
|
# .select{|d| Dir.exist?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
||||||
|
|
||||||
|
## Note: if you are using the `directories` clause above and you are not
|
||||||
|
## watching the project directory ('.'), then you will want to move
|
||||||
|
## the Guardfile to a watched dir and symlink it back, e.g.
|
||||||
|
#
|
||||||
|
# $ mkdir config
|
||||||
|
# $ mv Guardfile config/
|
||||||
|
# $ ln -s config/Guardfile .
|
||||||
|
#
|
||||||
|
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
||||||
|
|
||||||
|
# Note: The cmd option is now required due to the increasing number of ways
|
||||||
|
# rspec may be run, below are examples of the most common uses.
|
||||||
|
# * bundler: 'bundle exec rspec'
|
||||||
|
# * bundler binstubs: 'bin/rspec'
|
||||||
|
# * spring: 'bin/rspec' (This will use spring if running and you have
|
||||||
|
# installed the spring binstubs per the docs)
|
||||||
|
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
||||||
|
# * 'just' rspec: 'rspec'
|
||||||
|
|
||||||
|
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.call("routing/#{m[1]}_routing"),
|
||||||
|
rspec.spec.call("controllers/#{m[1]}_controller"),
|
||||||
|
rspec.spec.call("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" }
|
||||||
|
|
||||||
|
# Capybara features specs
|
||||||
|
watch(rails.view_dirs) { |m| rspec.spec.call("features/#{m[1]}") }
|
||||||
|
watch(rails.layouts) { |m| rspec.spec.call("features/#{m[1]}") }
|
||||||
|
|
||||||
|
# Turnip features and steps
|
||||||
|
watch(%r{^spec/acceptance/(.+)\.feature$})
|
||||||
|
watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m|
|
||||||
|
Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -273,6 +273,14 @@ Run the tests
|
||||||
bundle exec rake
|
bundle exec rake
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Automating test running
|
||||||
|
|
||||||
|
The guard-rspec gem will run the tests automatically when files are changed.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bundle exec guard
|
||||||
|
```
|
||||||
|
|
||||||
### Parallel test execution
|
### Parallel test execution
|
||||||
|
|
||||||
The [parallel tests](https://github.com/grosser/parallel_tests) gem is installed. It's optional to use.
|
The [parallel tests](https://github.com/grosser/parallel_tests) gem is installed. It's optional to use.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue