Skip to content

Commit

Permalink
initial test preparations
Browse files Browse the repository at this point in the history
  • Loading branch information
achiurizo committed Jan 24, 2010
1 parent d250528 commit 9d6153e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
45 changes: 45 additions & 0 deletions test.watchr
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#
# 'autotest' for riot
# install watchr
# $ sudo gem install watchr
#
# Run With:
# $ watchr test.watchr
#

# --------------------------------------------------
# Helpers
# --------------------------------------------------

def run(cmd)
puts(cmd)
system(cmd)
end

def run_all_tests
system( "rake test" )
end

def sudo(cmd)
run("sudo #{cmd}")
end

# --------------------------------------------------
# Watchr Rules
# --------------------------------------------------
watch("^lib.*/(.*)\.rb") { |m| run("ruby -rubygems test/#{m[1]}_test.rb") }
watch("test.*/teststrap\.rb") { run_all_tests }
watch('^test.*/(.*)_test\.rb') { |m| run("ruby -rubygems test/#{m[1]}_test.rb") }
watch('(.*)\.gemspec') { |m| sudo("rake install") }

# --------------------------------------------------
# Signal Handling
# --------------------------------------------------
# Ctrl-\
Signal.trap('QUIT') do
puts " --- Running all tests ---\n\n"
run_all_tests
end

# Ctrl-C
Signal.trap('INT') { abort("\n") }
2 changes: 1 addition & 1 deletion test/mplayer-ruby_test.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'teststrap'
require File.expand_path("teststrap", File.dirname(__FILE__))

context "mplayer-ruby" do
setup do
Expand Down
5 changes: 5 additions & 0 deletions test/teststrap.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
require 'rubygems'
require 'riot'
require 'rr'
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'mplayer-ruby'


Riot::Situation.instance_eval { include RR::Adapters::RRMethods }

0 comments on commit 9d6153e

Please sign in to comment.