Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 34 lines (28 sloc) 0.686 kb
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
1 def run_spec(file)
2 unless File.exist?(file)
3 puts "#{file} does not exist"
4 return
f2ebe80 @jnunemaker Moved serialization, associations, dirty tracking and callbacks to plugi...
jnunemaker authored
5 end
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
6
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
7 puts "Running #{file}"
8 system "bundle exec rspec #{file}"
9 puts
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
10 end
11
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
12 watch("spec/.*/*_spec.rb") do |match|
13 run_spec match[0]
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
14 end
15
16 def related_test_files(path)
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
17 Dir.glob "spec/**/#{File.basename(path, File.extname(path))}_spec.rb"
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
18 end
19
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
20 watch('lib/.*') do |m|
21 system('clear')
22 if files = related_test_files(m[0]) and !files.empty?
23 puts "bundle exec rspec #{files.join(" ")}"
24 system "bundle exec rspec #{files.join(" ")}"
25 end
26 end
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
27
28 Signal.trap('QUIT') do
29 puts " --- Running all tests ---\n\n"
a8073ab @cheald Fix run-all watchr task
cheald authored
30 system "bundle exec rake"
316fbc6 @jnunemaker Added a watchr (gem install watchr) to make continuous testing easier.
jnunemaker authored
31 end
32
33 # Ctrl-C
986875c @cheald Remove old test suite and update watchr scripts to point to rspec instea...
cheald authored
34 Signal.trap('INT') { abort("\n") }
Something went wrong with that request. Please try again.