rubycucumberzeus

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 including 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.


Solution

  • 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
      end
    
      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
      end
    end
    
    Zeus.plan = CucumberPlan.new