-
Notifications
You must be signed in to change notification settings - Fork 4
/
Rakefile
45 lines (40 loc) · 1.25 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
require 'rake'
require 'bundler/gem_tasks'
# Approach to version testing credited to
# https://github.com/makandra/cucumber_factory
namespace :versions do
namespace :bundle do
desc 'Bundle all spec apps'
task :install do
for_each_directory_of('./cucumber_version/**/Gemfile') do |directory|
Bundler.with_clean_env do
system("cd #{directory} && bundle install")
end
end
end
end
desc 'Test all supported cucumber versions'
task :test do
for_each_directory_of('./cucumber_version/**/Gemfile') do |directory|
Bundler.with_clean_env do
clean_outputs(directory)
system("cd #{directory} && bundle exec cucumber --color --format progress -g -r ../../features/ ../../features/")
system("bundle exec rspec -r #{directory}/output_path.rb ")
end
end
end
end
def clean_outputs(dir)
["#{dir}/features/characteristics/cucumber_step_characteristics.json",
"#{dir}/features/characteristics/cucumber_step_characteristics.html"
].each do |file|
File.delete(file) if File.exist?(file)
end
end
def for_each_directory_of(path)
Dir[path].sort.each do |rakefile|
directory = File.dirname(rakefile)
puts '', "\033[44m#{directory}\033[0m", ''
yield(directory)
end
end