Class: Polyamory::Cucumber

Inherits:
RSpec
  • Object
show all
Defined in:
lib/polyamory/cucumber.rb

Overview

Internal: Deals with finding specs to test

Instance Attribute Summary

Attributes inherited from RSpec

#context

Instance Method Summary collapse

Methods inherited from RSpec

#all_matching_files, #find_files, #glob, #handle?, #initialize, #pick_jobs, #resolve_as_directory, #resolve_as_file_pattern, #resolve_as_filename, #resolve_name, #resolve_paths, #rspec_options, #test_dir

Constructor Details

This class inherits a constructor from Polyamory::RSpec

Instance Method Details

#add_ruby_options(cmd) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/polyamory/cucumber.rb', line 23

def add_ruby_options cmd
  opts = []
  opts << '-w' if context.warnings?
  for path in context.load_paths
    opts << "-I#{path}"
  end
  opts << '%'
  cmd.env['RUBYOPT'] = opts.join(' ') if opts.size > 1
end

#cucumber_optionsObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/polyamory/cucumber.rb', line 33

def cucumber_options
  opts = []
  opts << '-b' if context.full_backtrace?
  for filter in context.name_filters
    opts << '-n' << filter
  end
  for tag in context.tag_filters
    opts << '-t' << normalize_tag(tag)
  end
  opts
end

#file_pattern(dir) ⇒ Object



11
12
13
# File 'lib/polyamory/cucumber.rb', line 11

def file_pattern dir
  "#{dir}/**/*.feature"
end

#normalize_tag(tag) ⇒ Object



45
46
47
48
# File 'lib/polyamory/cucumber.rb', line 45

def normalize_tag tag
  tag = "#$1@#$2" if tag =~ /^(~)?(\w+)$/
  tag
end

#test_command(paths) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/polyamory/cucumber.rb', line 15

def test_command paths
  Command.new 'cucumber' do |test_job|
    add_ruby_options test_job
    test_job.concat cucumber_options
    test_job.concat paths.map {|p| p.relative }
  end
end

#test_dir_nameObject



7
8
9
# File 'lib/polyamory/cucumber.rb', line 7

def test_dir_name
  'features'
end