Last active
December 13, 2015 22:08
-
-
Save aokolish/4982244 to your computer and use it in GitHub Desktop.
how to get simplecov results when running specs from zeus.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'simplecov' | |
SimpleCov.configure do | |
SimpleCov.refuse_coverage_drop | |
add_filter "/spec/" | |
add_filter "scraper.rb" # don't care that this is spaghetti code | |
add_filter "error_messages_helper.rb" | |
add_filter "/config/" | |
add_filter "controller" | |
SimpleCov.minimum_coverage 93 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zeus/rails' | |
class CustomPlan < Zeus::Rails | |
def test | |
require 'simplecov' | |
SimpleCov.start | |
# you may need to load other files... | |
Dir["#{Rails.root}/app/helpers/**/*.rb"].each { |f| load f } | |
super | |
end | |
end | |
Zeus.plan = CustomPlan.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def zeus_running? | |
File.exists? '.zeus.sock' | |
end | |
if !zeus_running? | |
SimpleCov.start | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"command": "ruby -rubygems -r./custom_plan -eZeus.go", | |
"plan": { | |
"boot": { | |
"default_bundle": { | |
"development_environment": { | |
"prerake": {"rake": []}, | |
"runner": ["r"], | |
"console": ["c"], | |
"server": ["s"], | |
"generate": ["g"], | |
"destroy": ["d"], | |
"dbconsole": [] | |
}, | |
"test_environment": { | |
"test_helper": {"test": ["rspec", "testrb"]} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I believe you can also check ENV['ZEUS_MASTER_FD'] to see if it is running inside a zeus process.