2010-01-20 16:58:56 +00:00
|
|
|
require 'rubygems'
|
|
|
|
require 'test/unit'
|
2011-03-22 23:22:12 +00:00
|
|
|
gem 'shoulda', '2.10.3'
|
|
|
|
gem 'rspec', '2.0.0.beta.19'
|
2010-01-20 16:58:56 +00:00
|
|
|
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-06-09 18:24:32 +00:00
|
|
|
File.expand_path(File.join(Dir.consistent_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
|
2010-06-09 18:24:32 +00:00
|
|
|
File.expand_path(File.join(Dir.consistent_tmpdir, 'alternate_hydra_test.txt'))
|
2010-03-31 15:05:42 +00:00
|
|
|
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-04-20 10:33:28 +00:00
|
|
|
def rspec_file_with_pending
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'write_file_with_pending_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-05-28 14:38:58 +00:00
|
|
|
|
|
|
|
def javascript_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'js_file.js'))
|
|
|
|
end
|
2010-05-28 14:42:17 +00:00
|
|
|
|
|
|
|
def json_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'json_data.json'))
|
|
|
|
end
|
2010-08-28 02:35:11 +00:00
|
|
|
|
|
|
|
def conflicting_test_file
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), 'fixtures', 'conflicting.rb'))
|
|
|
|
end
|
2011-05-30 17:40:44 +00:00
|
|
|
|
|
|
|
def remote_dir_path
|
|
|
|
File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
|
|
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
|
|
|
|
|