rspec 2.0 support
This commit is contained in:
parent
ca4b97443e
commit
05410b1af5
2
Rakefile
2
Rakefile
@ -11,7 +11,7 @@ begin
|
||||
gem.homepage = "http://github.com/ngauthier/hydra"
|
||||
gem.authors = ["Nick Gauthier"]
|
||||
gem.add_development_dependency "shoulda", "= 2.10.3"
|
||||
gem.add_development_dependency "rspec", "= 1.3.0"
|
||||
gem.add_development_dependency "rspec", "= 2.0.0.beta.19"
|
||||
gem.add_development_dependency "cucumber", "= 0.8.5"
|
||||
gem.add_development_dependency "therubyracer", "= 0.7.4"
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
||||
|
||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||
s.authors = ["Nick Gauthier"]
|
||||
s.date = %q{2010-08-20}
|
||||
s.date = %q{2010-08-23}
|
||||
s.default_executable = %q{warmsnake.rb}
|
||||
s.description = %q{Spread your tests over multiple machines to test your code faster.}
|
||||
s.email = %q{nick@smartlogicsolutions.com}
|
||||
@ -112,18 +112,18 @@ Gem::Specification.new do |s|
|
||||
|
||||
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
||||
s.add_development_dependency(%q<shoulda>, ["= 2.10.3"])
|
||||
s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
|
||||
s.add_development_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
|
||||
s.add_development_dependency(%q<cucumber>, ["= 0.8.5"])
|
||||
s.add_development_dependency(%q<therubyracer>, ["= 0.7.4"])
|
||||
else
|
||||
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
||||
s.add_dependency(%q<rspec>, ["= 1.3.0"])
|
||||
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
|
||||
s.add_dependency(%q<cucumber>, ["= 0.8.5"])
|
||||
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
|
||||
end
|
||||
else
|
||||
s.add_dependency(%q<shoulda>, ["= 2.10.3"])
|
||||
s.add_dependency(%q<rspec>, ["= 1.3.0"])
|
||||
s.add_dependency(%q<rspec>, ["= 2.0.0.beta.19"])
|
||||
s.add_dependency(%q<cucumber>, ["= 0.8.5"])
|
||||
s.add_dependency(%q<therubyracer>, ["= 0.7.4"])
|
||||
end
|
||||
|
@ -107,7 +107,7 @@ module Hydra #:nodoc:
|
||||
def run_rspec_file(file)
|
||||
# pull in rspec
|
||||
begin
|
||||
require 'spec'
|
||||
require 'rspec'
|
||||
require 'hydra/spec/hydra_formatter'
|
||||
# Ensure we override rspec's at_exit
|
||||
require 'hydra/spec/autorun_override'
|
||||
@ -115,22 +115,15 @@ module Hydra #:nodoc:
|
||||
return ex.to_s
|
||||
end
|
||||
hydra_output = StringIO.new
|
||||
Spec::Runner.options.instance_variable_set(:@formatters, [
|
||||
Spec::Runner::Formatter::HydraFormatter.new(
|
||||
Spec::Runner.options.formatter_options,
|
||||
hydra_output
|
||||
)
|
||||
])
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@example_groups, []
|
||||
)
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@files, [file]
|
||||
)
|
||||
Spec::Runner.options.instance_variable_set(
|
||||
:@files_loaded, false
|
||||
)
|
||||
Spec::Runner.options.run_examples
|
||||
|
||||
config = [
|
||||
'-f', 'RSpec::Core::Formatters::HydraFormatter',
|
||||
file
|
||||
]
|
||||
|
||||
RSpec.instance_variable_set(:@world, nil)
|
||||
RSpec::Core::Runner.run(config, hydra_output, hydra_output)
|
||||
|
||||
hydra_output.rewind
|
||||
output = hydra_output.read.chomp
|
||||
output = "" if output.gsub("\n","") =~ /^\.*$/
|
||||
|
@ -1,12 +1,3 @@
|
||||
if defined?(Spec)
|
||||
module Spec
|
||||
module Runner
|
||||
class << self
|
||||
# stop the auto-run at_exit
|
||||
def run
|
||||
return 0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if defined?(RSpec)
|
||||
RSpec::Core::Runner.disable_autorun!
|
||||
end
|
||||
|
@ -1,14 +1,23 @@
|
||||
require 'spec/runner/formatter/progress_bar_formatter'
|
||||
module Spec
|
||||
module Runner
|
||||
module Formatter
|
||||
class HydraFormatter < ProgressBarFormatter
|
||||
require 'rspec/core/formatters/progress_formatter'
|
||||
module RSpec
|
||||
module Core
|
||||
module Formatters
|
||||
class HydraFormatter < ProgressFormatter
|
||||
def example_passed(example)
|
||||
end
|
||||
|
||||
def example_pending(example)
|
||||
end
|
||||
|
||||
def example_failed(example)
|
||||
end
|
||||
|
||||
# Stifle the post-test summary
|
||||
def dump_summary(duration, example, failure, pending)
|
||||
end
|
||||
|
||||
# Stifle the output of pending examples
|
||||
def example_pending(*args)
|
||||
# Stifle pending specs
|
||||
def dump_pending
|
||||
end
|
||||
end
|
||||
end
|
||||
|
2
test/fixtures/write_file_alternate_spec.rb
vendored
2
test/fixtures/write_file_alternate_spec.rb
vendored
@ -1,5 +1,5 @@
|
||||
require 'tmpdir'
|
||||
require 'spec'
|
||||
require 'rspec'
|
||||
context "file writing" do
|
||||
it "writes to a file" do
|
||||
File.open(File.join(Dir.tmpdir, 'alternate_hydra_test.txt'), 'a') do |f|
|
||||
|
2
test/fixtures/write_file_spec.rb
vendored
2
test/fixtures/write_file_spec.rb
vendored
@ -1,5 +1,5 @@
|
||||
require 'tmpdir'
|
||||
require 'spec'
|
||||
require 'rspec'
|
||||
context "file writing" do
|
||||
it "writes to a file" do
|
||||
File.open(File.join(Dir.tmpdir, 'hydra_test.txt'), 'a') do |f|
|
||||
|
@ -1,5 +1,5 @@
|
||||
require 'tmpdir'
|
||||
require 'spec'
|
||||
require 'rspec'
|
||||
context "file writing" do
|
||||
it "writes to a file" do
|
||||
File.open(File.join(Dir.tmpdir, 'hydra_test.txt'), 'a') do |f|
|
||||
|
@ -50,6 +50,7 @@ class RunnerTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "run two rspec tests" do
|
||||
puts "First test"
|
||||
runner = Hydra::Runner.new(:io => File.new('/dev/null', 'w'))
|
||||
runner.run_file(rspec_file)
|
||||
assert File.exists?(target_file)
|
||||
@ -60,7 +61,7 @@ class RunnerTest < Test::Unit::TestCase
|
||||
runner.run_file(alternate_rspec_file)
|
||||
assert File.exists?(alternate_target_file)
|
||||
assert_equal "HYDRA", File.read(alternate_target_file)
|
||||
assert !File.exists?(target_file)
|
||||
assert !File.exists?(target_file), "Tests are double running!"
|
||||
end
|
||||
|
||||
should "run rspec tests with pending examples" do
|
||||
|
Loading…
Reference in New Issue
Block a user