Avram Avram - 4 years ago 87
Ruby Question

How do you use cucumber with zeus?

When I start up zeus, it does not offer

zeus cucumber
as one of the possible commands. Others seem to get this by default; At least I have seen a couple zeus write-ups that show the output from
zeus start
zeus cucumber
, and they don't say anything about that having been special or required extra configuration.

I don't really even know where to start to troubleshoot this; I have googled and searched here for "use cucumber with zeus." I get no setup discussions. The only results I get are from people who seem to take for granted that it should be there, and are investigating problems with it not functioning correctly.

Answer Source

You should use this custom plan file from Zeus. Save it as custom_plan.rb at the root of your application:

require 'zeus/rails'                   

# 1. Add the cucumber methods (below) to your custom plan (or take this file if
# you don't have an existing custom_plan).
# 2. Add the following line to the test_environment section of your zeus.json:
#   "cucumber_environment": {"cucumber": []}

class CucumberPlan < Zeus::Rails         
  def cucumber_environment
    ::Rails.env = ENV['RAILS_ENV'] = 'test'
    require 'cucumber/rspec/disable_option_parser'
    require 'cucumber/cli/main'
    @cucumber_runtime = Cucumber::Runtime.new

  def cucumber(argv=ARGV)
    cucumber_main = Cucumber::Cli::Main.new(argv.dup)
    had_failures = cucumber_main.execute!(@cucumber_runtime)
    exit_code = had_failures ? 1 : 0
    exit exit_code

Zeus.plan = CucumberPlan.new
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download