Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ GEM
bummr (0.3.2)
rainbow
thor
byebug (10.0.0)
byebug (10.0.2)
capybara (2.17.0)
addressable
mini_mime (>= 0.1.3)
Expand Down
63 changes: 63 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# 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.exists?(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: ENV['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]}") }
end
32 changes: 23 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,23 +239,37 @@ To run a subset of tests excluding slow tests (such as accessibility specs):
$ make fast_test
```

#### Speeding up local development and testing
To automatically run the test that corresponds to the file you are editing,
run `bundle exec guard` with the env var `GUARD_RSPEC_CMD` set to your preferred
command for running `rspec`. For example, if you use [Zeus](https://github.com/burke/zeus),
you would set the env var to `zeus rspec`:
```console
GUARD_RSPEC_CMD="zeus rspec" bundle exec guard
```

If you don't specify the `GUARD_RSPEC_CMD` env var, it will default to
`bundle exec rspec`.

We recommend setting up a shell alias for running this command, such as:
```console
alias idpguard='GUARD_RSPEC_CMD="zeus rspec" bundle exec guard'
```

#### Troubleshooting
If you are on a mac, if you receive the following prompt the first time you run the test suite, enter `sekret` as the passphrase:

![alt text][mac-test-passphrase-prompt]

See RSpec [docs](https://relishapp.com/rspec/rspec-core/docs/command-line) for
more information.
#### Documentation for the testing tools we use
[RSpec](https://relishapp.com/rspec/rspec-core/docs/command-line)

[Guard](https://github.com/guard/guard-rspec)

JavaScript unit tests run using the mocha test runner. Check out the
[mocha documentation](https://mochajs.org/) for more details.

Run security scanner

```
$ make brakeman
```

#### User flows
### User flows

We have an automated tool for generating user flows using real views generated from the application. These specs are excluded from our typical spec run because of the overhead of generating screenshots for each view.

Expand Down