Skip to content

Commit

Permalink
updated Rakefile
Browse files Browse the repository at this point in the history
Signed-off-by: nikhil2611 <[email protected]>
  • Loading branch information
nikhil2611 committed Jul 12, 2024
1 parent 2f2b32e commit e2eaef9
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions Rakefile
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

0 comments on commit e2eaef9

Please sign in to comment.