Skip to content

Commit

Permalink
Update zeus/rails.rb / zeus.json to reflect new merged test stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
burke committed Sep 15, 2012
1 parent baf9b6d commit a856041
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 25 deletions.
4 changes: 1 addition & 3 deletions examples/zeus.json
Expand Up @@ -13,9 +13,7 @@
},
"test_environment": {
"cucumber_environment": {"cucumber": []},
"test": [],
"test_helper": {"testrb": []},
"spec_helper": {"rspec": []}
"test_helper": {"test": ["rspec", "testrb"]}
}
}
}
Expand Down
39 changes: 17 additions & 22 deletions rubygem/lib/zeus/rails.rb
Expand Up @@ -8,6 +8,14 @@

module Zeus
class Rails < Plan
def deprecated
puts "Zeus 0.11.0 changed zeus.json. You'll have to rm zeus.json && zeus init."
end
alias_method :spec_helper, :deprecated
alias_method :testrb, :deprecated
alias_method :rspec, :deprecated


def after_fork
reconnect_activerecord
restart_girl_friday
Expand Down Expand Up @@ -82,39 +90,26 @@ def test_environment
$rails_rake_task = 'yup' # lie to skip eager loading
::Rails.application.require_environment!
$rails_rake_task = nil
$LOAD_PATH.unshift(ROOT_PATH) unless $LOAD_PATH.include?(ROOT_PATH)
$LOAD_PATH.unshift(ROOT_PATH + "/lib") unless $LOAD_PATH.include?(ROOT_PATH + "/lib")

if Dir.exist?(ROOT_PATH + "/test")
test = File.join(ROOT_PATH, 'test')
$LOAD_PATH.unshift(test) unless $LOAD_PATH.include?(test)
end

if Dir.exist?(ROOT_PATH + "/spec")
spec = File.join(ROOT_PATH, 'spec')
$LOAD_PATH.unshift(spec) unless $LOAD_PATH.include?(spec)
end
$LOAD_PATH.unshift ".", "./lib", "./test", "./spec"
end

def test_helper
if File.exist?(ROOT_PATH + "/test/minitest_helper.rb")
if File.exists?(ROOT_PATH + "/spec/spec_helper.rb")
require 'spec_helper'
elsif File.exist?(ROOT_PATH + "/test/minitest_helper.rb")
require 'minitest_helper'
else
require 'test_helper'
end
end

def test
Zeus::M.run(ARGV)
end
alias_method :testrb, :test # for compatibility with 0.10.x

def spec_helper
require 'spec_helper'
end

def rspec
exit RSpec::Core::Runner.run(ARGV)
if defined?(RSpec)
exit RSpec::Core::Runner.run(ARGV)
else
Zeus::M.run(ARGV)
end
end

def cucumber_environment
Expand Down

0 comments on commit a856041

Please sign in to comment.