Sha256: 5837b8dffe2ef714eb311580f039e7af836fff0004b9e946a5b53d78bda125cf
Contents?: true
Size: 1.72 KB
Versions: 3
Compression:
Stored size: 1.72 KB
Contents
require 'yaml' module Shoe module Tasks # Defines <tt>`rake cucumber`</tt> and <tt>`rake cucumber:<PROFILE>`</tt> to # run your Cucumber[http://cukes.info] features. # # <tt>`rake cucumber`</tt> will run features according to the # <tt>default</tt> profile; <tt>`rake cucumber:foo`</tt> according to the # <tt>foo</tt> profile. # # To enable and configure, create and edit your # <tt>{cucumber.yml}[http://wiki.github.com/aslakhellesoy/cucumber/cucumberyml]</tt>. class Cucumber < Task def active? !cucumber_profiles.empty? end def define begin require 'cucumber/rake/task' rescue LoadError warn "WARN: Please `gem install cucumber`." else define_tasks end end private def define_tasks cucumber_profiles.each do |profile| if profile == 'default' define_default_task else define_profile_task(profile) end end end def cucumber_profiles YAML.load_file('cucumber.yml').keys rescue [] end def define_default_task task :prepare ::Cucumber::Rake::Task.new({ :cucumber => :prepare }, "Run features.\nConfigure via the default profile in cucumber.yml.") do |task| task.profile = 'default' end task :default => :cucumber end def define_profile_task(profile) task :prepare namespace :cucumber do ::Cucumber::Rake::Task.new({ profile => :prepare }, "Run #{profile} features.\nConfigure via the #{profile} profile in cucumber.yml.") do |task| task.profile = profile end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
shoe-0.8.0 | lib/shoe/tasks/cucumber.rb |
shoe-0.7.1 | lib/shoe/tasks/cucumber.rb |
shoe-0.7.0 | lib/shoe/tasks/cucumber.rb |