master
1# IMPORTANT: This file is generated by cucumber-rails - edit at your own peril.
2# It is recommended to regenerate this file in the future when you upgrade to a
3# newer version of cucumber-rails. Consider adding your own code to a new file
4# instead of editing this one. Cucumber will automatically load all features/**/*.rb
5# files.
6
7
8unless ARGV.any? {|a| a =~ /^gems/} # Don't load anything when running the gems:* tasks
9
10vendored_cucumber_bin = Dir["#{Rails.root}/vendor/{gems,plugins}/cucumber*/bin/cucumber"].first
11$LOAD_PATH.unshift(File.dirname(vendored_cucumber_bin) + '/../lib') unless vendored_cucumber_bin.nil?
12
13begin
14 require 'cucumber/rake/task'
15
16 namespace :cucumber do
17 Cucumber::Rake::Task.new({:ok => 'test:prepare'}, 'Run features that should pass') do |t|
18 t.binary = vendored_cucumber_bin # If nil, the gem's binary is used.
19 t.fork = true # You may get faster startup if you set this to false
20 t.profile = 'default'
21 end
22
23 Cucumber::Rake::Task.new({:wip => 'test:prepare'}, 'Run features that are being worked on') do |t|
24 t.binary = vendored_cucumber_bin
25 t.fork = true # You may get faster startup if you set this to false
26 t.profile = 'wip'
27 end
28
29 Cucumber::Rake::Task.new({:rerun => 'test:prepare'}, 'Record failing features and run only them if any exist') do |t|
30 t.binary = vendored_cucumber_bin
31 t.fork = true # You may get faster startup if you set this to false
32 t.profile = 'rerun'
33 end
34
35 desc 'Run all features'
36 task :all => [:ok, :wip]
37
38 task :statsetup do
39 require 'rails/code_statistics'
40 ::STATS_DIRECTORIES << %w(Cucumber\ features features) if File.exist?('features')
41 ::CodeStatistics::TEST_TYPES << "Cucumber features" if File.exist?('features')
42 end
43
44 task :annotations_setup do
45 Rails.application.configure do
46 if config.respond_to?(:annotations)
47 config.annotations.directories << 'features'
48 config.annotations.register_extensions('feature') { |tag| /#\s*(#{tag}):?\s*(.*)$/ }
49 end
50 end
51 end
52 end
53 desc 'Alias for cucumber:ok'
54 task :cucumber => 'cucumber:ok'
55
56 task :default => :cucumber
57
58 task :features => :cucumber do
59 STDERR.puts "*** The 'features' task is deprecated. See rake -T cucumber ***"
60 end
61
62 # In case we don't have the generic Rails test:prepare hook, append a no-op task that we can depend upon.
63 task 'test:prepare' do
64 end
65
66 task :stats => 'cucumber:statsetup'
67
68 task :notes => 'cucumber:annotations_setup'
69rescue LoadError
70 desc 'cucumber rake task not available (cucumber not installed)'
71 task :cucumber do
72 abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
73 end
74end
75
76end