Merge branch 'master' into 2-0-stable-jan-8th

This commit is contained in:
luisramos0
2019-01-08 14:29:50 +00:00
42 changed files with 977 additions and 144 deletions

47
lib/tasks/specs.rake Normal file
View File

@@ -0,0 +1,47 @@
namespace :openfoodnetwork do
namespace :specs do
namespace :engines do
def detect_engine_paths
Pathname("engines/").children.select(&:directory?)
end
def engine_name_for_engine(engine_path)
engine_path.basename.to_path
end
def execute_rspec_for_engine(engine_path)
system "cd #{engine_path.expand_path} && DISABLE_KNAPSACK=true bundle exec rspec"
end
engine_paths = detect_engine_paths
engine_paths.each do |engine_path|
engine_name = engine_name_for_engine(engine_path)
namespace engine_name do
desc "Run RSpec tests for engine \"#{engine_name}\""
task :rspec do
success = execute_rspec_for_engine(engine_path)
abort "Failure when running tests for engine \"#{engine_name}\"" unless success
end
end
end
namespace :all do
desc "Run RSpec tests for all engines"
task :rspec do
success = true
engine_paths.each do |engine_path|
success = !!execute_rspec_for_engine(engine_path) && success
end
abort "Failure encountered when running tests for engines" unless success
end
end
desc "Alias for openfoodnetwork:specs:engines:all:rspec"
task rspec: "all:rspec"
end
end
end