summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authormo k <mo@mokhan.ca>2012-05-22 07:13:23 -0600
committermo k <mo@mokhan.ca>2012-05-22 07:13:23 -0600
commitf71649a4141afc31ab6efff1a76c430c5381e0b4 (patch)
tree43a32a0486c62c521a2140d95aa7ba916f23dc2c /script
parent3b923cea35f3a0d5f6d13c1275160ed9e132e4d2 (diff)
add validation for website url on User model.
Diffstat (limited to 'script')
-rw-r--r--script/features5
-rw-r--r--script/test35
2 files changed, 40 insertions, 0 deletions
diff --git a/script/features b/script/features
new file mode 100644
index 00000000..142a4bb1
--- /dev/null
+++ b/script/features
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+set -e
+
+cucumber -drb $*
diff --git a/script/test b/script/test
new file mode 100644
index 00000000..7f7a13e8
--- /dev/null
+++ b/script/test
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# From Destroy All Software screencast #10, at:
+# http://destroyallsoftware.com/screencasts/catalog/fast-tests-with-and-without-rails
+#
+# 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
+