Module: Racatt

Extended by:
Rake::DSL
Defined in:
lib/racatt.rb,
lib/racatt/version.rb

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.create_tasksObject



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
# File 'lib/racatt.rb', line 16

def self.create_tasks
  current_scope = Rake.application.current_scope.path

  namespace 'cucumber' do
    desc 'Run all of the Cucumber features'
    task :features, [:command_options] do |_t, args|
      set_cucumber_options(args[:command_options]) if args[:command_options]
    end
    Cucumber::Rake::Task.new(:features)
  end

  namespace 'rspec' do
    desc 'Run all of the RSpec specifications'
    RSpec::Core::RakeTask.new(:specs, :command_options) do |t, args|
      t.rspec_opts = args[:command_options] if args[:command_options]
    end
  end

  desc 'Test All The Things!'
  task :test_everything, [:rspec_command_options, :cucumber_command_options] do |_t, args|
    scope_string = current_scope.empty? ? '' : "#{current_scope}:"

    Rake::Task["#{scope_string}rspec:specs"].invoke(args[:rspec_command_options])
    Rake::Task["#{scope_string}cucumber:features"].invoke(args[:cucumber_command_options])
  end

end

.set_cucumber_options(options) ⇒ Object



12
13
14
# File 'lib/racatt.rb', line 12

def self.set_cucumber_options(options)
  ENV['CUCUMBER_OPTS'] = options
end