-
Notifications
You must be signed in to change notification settings - Fork 72
/
Rakefile
52 lines (44 loc) · 1.33 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
require 'cucumber/rake/task'
class BuildFailure < Exception;
def initialize(message = nil)
message ||= "Build failed"
super(message)
end
end;
Cucumber::Rake::Task.new do |t|
t.cucumber_opts = "--format progress --tags ~@failing"
end
Cucumber::Rake::Task.new(:focus) do |t|
t.cucumber_opts = "--format progress --tags @focus"
end
namespace :features do
desc "Run all features"
Cucumber::Rake::Task.new(:all) do |t|
t.cucumber_opts = "--format progress"
end
desc "Run in-progress features"
Cucumber::Rake::Task.new(:in_progress) do |t|
t.cucumber_opts = "--require formatters/ --format Cucumber::Formatter::InProgress --tags @failing"
end
end
desc "Run complete feature build"
task :cruise do
finished_successful = run_and_check_for_exception("cucumber")
in_progress_successful = run_and_check_for_exception("features:in_progress")
unless finished_successful && in_progress_successful
puts
puts("Finished features had failing steps") unless finished_successful
puts("In-progress Scenario/s passed when they should fail or be pending") unless in_progress_successful
puts
raise BuildFailure
end
end
def run_and_check_for_exception(task_name)
puts "*** Running #{task_name} features ***"
begin
Rake::Task["#{task_name}"].invoke
rescue Exception => e
return false
end
true
end