hydra/test/test_helper.rb

37 lines
791 B
Ruby
Raw Normal View History

2010-01-20 16:58:56 +00:00
require 'rubygems'
require 'test/unit'
require 'shoulda'
require 'tmpdir'
2010-01-20 16:58:56 +00:00
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'hydra'
# Since Hydra turns off testing, we have to turn it back on
Test::Unit.run = false
2010-01-20 16:58:56 +00:00
class Test::Unit::TestCase
def target_file
2010-02-03 21:03:16 +00:00
File.expand_path(File.join(Dir.tmpdir, 'hydra_test.txt'))
end
def test_file
2010-02-03 21:03:16 +00:00
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file.rb'))
end
end
module Hydra #:nodoc:
module Messages #:nodoc:
class TestMessage < Hydra::Message
attr_accessor :text
def initialize(opts = {})
@text = opts.fetch(:text){ "test" }
end
def serialize
super(:text => @text)
end
end
end
end