-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: nikhil2611 <[email protected]>
- Loading branch information
1 parent
2f2b32e
commit e2eaef9
Showing
1 changed file
with
17 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,53 @@ | ||
require "bundler/gem_tasks" | ||
require 'bundler/gem_tasks' | ||
|
||
WINDOWS_PLATFORM = %w{ x64-mingw32 x64-mingw-ucrt ruby }.freeze | ||
WINDOWS_PLATFORM = %w[x64-mingw32 x64-mingw-ucrt ruby].freeze | ||
|
||
# Style Tests | ||
begin | ||
require "chefstyle" | ||
require "rubocop/rake_task" | ||
require 'chefstyle' | ||
require 'rubocop/rake_task' | ||
RuboCop::RakeTask.new do |t| | ||
t.formatters = ["progress"] | ||
t.options = ["-D"] | ||
t.formatters = ['progress'] | ||
t.options = ['-D'] | ||
end | ||
|
||
# style is an alias for rubocop | ||
task style: :rubocop | ||
rescue LoadError | ||
puts "ChefStyle not available; disabling style checking tasks" | ||
puts 'ChefStyle not available; disabling style checking tasks' | ||
end | ||
|
||
# Unit Tests | ||
begin | ||
require "rspec/core/rake_task" | ||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new | ||
|
||
# Coverage | ||
desc "Generate unit test coverage report" | ||
desc 'Generate unit test coverage report' | ||
task :coverage do | ||
ENV["COVERAGE"] = "true" | ||
ENV['COVERAGE'] = 'true' | ||
Rake::Task[:spec].invoke | ||
end | ||
rescue LoadError | ||
puts "RSpec not available; disabling rspec tasks" | ||
puts 'RSpec not available; disabling rspec tasks' | ||
# create a no-op spec task for :default | ||
task :spec | ||
end | ||
|
||
# Feature Tests | ||
begin | ||
require "cucumber" | ||
require "cucumber/rake/task" | ||
require 'cucumber' | ||
require 'cucumber/rake/task' | ||
Cucumber::Rake::Task.new(:features) do |t| | ||
if RUBY_PLATFORM =~ WINDOWS_PLATFORM || RUBY_PLATFORM =~ /darwin/ | ||
t.cucumber_opts = "--tags 'not @not-windows'" | ||
end | ||
t.cucumber_opts = "--tags 'not @not-windows'" if RUBY_PLATFORM =~ WINDOWS_PLATFORM || RUBY_PLATFORM =~ /darwin/ | ||
end | ||
rescue LoadError | ||
puts "Cucumber/Aruba not available; disabling feature tasks" | ||
puts 'Cucumber/Aruba not available; disabling feature tasks' | ||
# create a no-op spec task for :default | ||
task :features | ||
end | ||
|
||
# test or the default task runs spec, features, style | ||
desc "run all tests" | ||
task default: %i{coverage features style} | ||
desc 'run all tests' | ||
task default: %i[coverage features style] | ||
task test: :default |