2010-01-20 16:58:56 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'test/unit'
|
|
|
|
require 'shoulda'
|
2010-01-27 22:19:32 +00:00
|
|
|
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'
|
|
|
|
|
2010-02-10 19:02:19 +00:00
|
|
|
# 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
|
2010-01-29 19:56:02 +00:00
|
|
|
def target_file
|
2010-02-03 21:03:16 +00:00
|
|
|
File.expand_path(File.join(Dir.tmpdir, 'hydra_test.txt'))
|
2010-01-29 19:56:02 +00:00
|
|
|
end
|
2010-03-31 15:05:42 +00:00
|
|
|
|
|
|
|
def alternate_target_file
|
|
|
|
File.expand_path(File.join(Dir.tmpdir, 'alternate_hydra_test.txt'))
|
|
|
|
end
|
2010-01-27 20:19:48 +00:00
|
|
|
|
2010-01-29 19:56:02 +00:00
|
|
|
def test_file
|
2010-02-03 21:03:16 +00:00
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file.rb'))
|
2010-01-29 19:56:02 +00:00
|
|
|
end
|
2010-03-30 17:45:10 +00:00
|
|
|
|
2010-04-03 21:27:27 +00:00
|
|
|
def rspec_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file_spec.rb'))
|
|
|
|
end
|
|
|
|
|
2010-04-04 00:32:00 +00:00
|
|
|
def alternate_rspec_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file_alternate_spec.rb'))
|
|
|
|
end
|
|
|
|
|
2010-03-30 17:45:10 +00:00
|
|
|
def cucumber_feature_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'features', 'write_file.feature'))
|
|
|
|
end
|
2010-03-31 15:05:42 +00:00
|
|
|
|
|
|
|
def alternate_cucumber_feature_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'features', 'write_alternate_file.feature'))
|
|
|
|
end
|
2010-01-29 19:56:02 +00:00
|
|
|
end
|
2010-01-29 18:01:53 +00:00
|
|
|
|
2010-01-27 20:19:48 +00:00
|
|
|
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
|
|
|
|
|