add vcr gem, add test helper script for running specific lines
This commit is contained in:
23
script/testing/dtest
Executable file
23
script/testing/dtest
Executable 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")
|
||||
Reference in New Issue
Block a user