Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export ENABLE_HTTPS="yes" | ||
export POW_TIMEOUT=3600 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
# | ||
# From Destroy All Software screencast #10, at: | ||
# http://destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails | ||
# | ||
# Released under the MIT license: http://opensource.org/licenses/MIT | ||
# | ||
# Put this in the script/ directory of your Rails app, then run it with a spec | ||
# filename. If the spec uses spec_helper, it'll be run inside Bundler. | ||
# Otherwise, it'll be run directly with whatever `rspec` executable is on the | ||
# path. | ||
|
||
set -e | ||
|
||
need_rails=1 | ||
|
||
if [ $# -gt 0 ]; then # we have args | ||
filename=$1 | ||
# Remove trailing line numbers from filename, e.g. spec/my_spec.rb:33 | ||
grep_filename=`echo $1 | sed 's/:.*$//g'` | ||
|
||
(set +e; grep -r '\bspec_helper\b' $grep_filename) > /dev/null | ||
if [ $? -eq 1 ]; then # no match; we have a stand-alone spec | ||
need_rails='' | ||
fi | ||
else # we have no args | ||
filename='spec' | ||
fi | ||
|
||
command='rspec' | ||
|
||
if [ $need_rails ]; then | ||
command="ruby -S bundle exec $command" | ||
fi | ||
|
||
RAILS_ENV=test $command $filename |