add vcr gem, add test helper script for running specific lines

This commit is contained in:
r888888888
2013-04-30 17:09:34 -07:00
parent 735824f8ca
commit 0a82162802
3 changed files with 27 additions and 3 deletions

View File

@@ -6,7 +6,8 @@ group :test do
gem "mocha", :require => "mocha/setup"
gem "ffaker", :git => "http://github.com/EmmanuelOga/ffaker.git"
gem "simplecov", :require => false
gem "testrbl"
gem "pry"
gem "vcr"
end
group :assets do

View File

@@ -178,7 +178,6 @@ GEM
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
term-ansicolor (1.1.4)
testrbl (0.2.0)
therubyracer (0.11.4)
libv8 (~> 3.11.8.12)
ref
@@ -198,6 +197,7 @@ GEM
kgio (~> 2.6)
rack
raindrops (~> 0.7)
vcr (2.4.0)
webrobots (0.1.1)
whenever (0.8.2)
activesupport (>= 2.3.4)
@@ -236,8 +236,8 @@ DEPENDENCIES
simple_form
simplecov
term-ansicolor
testrbl
therubyracer
uglifier (>= 1.0.3)
unicorn
vcr
whenever

23
script/testing/dtest Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env ruby
file, line = ARGV[0], nil
test_name_pattern = nil
if file =~ /:\d+/
file, line = file.split(/:/)
end
if line
text = File.read(file).split(/\r\n|\r|\n/)[line.to_i - 1]
if text =~ /(?:context|should) ["'](.+?)["']/
test_name_pattern = Regexp.escape($1)
end
end
env_options = {
"TEST" => file
}
env_options["TESTOPTS"] = "--name='/#{test_name_pattern}/'" if test_name_pattern
exec(env_options, "bundle exec rake test")