# Copyright (c) 2023 Jerome Arbez-Gindre # frozen_string_literal: true require('cucumber/rake/task') require('rspec/core/rake_task') namespace 'test' do RSpec::Core::RakeTask.new(:spec) cuke_results = 'features_results.html' CLEAN << cuke_results Cucumber::Rake::Task.new(:features) do |t| opts = ['features'] + ['--format', 'html'] + ['-o', cuke_results] + ['--format', 'progress'] + ['-x'] opts += ['--tags', ENV.fetch('TAGS').split.join(' or ')] if ENV['TAGS'] t.cucumber_opts = opts end Cucumber::Rake::Task.new('features:wip') do |t| t.cucumber_opts = ['features'] + ['--format', 'html'] + ['-o', cuke_results] + ['--format', 'pretty'] + ['-x'] + ['-s'] + ['--tags', '@wip and not @pending'] end desc 'Runs all unit tests and acceptance tests' task(all: ['test:spec', 'test:features']) end desc 'Synonym for test:spec' task(spec: 'test:spec') desc 'Synonym for test:all' task(test: 'test:all') desc('Test all features') task(cucumber: 'test:features')