geordi 0.12.4 → 0.12.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/geordi/cuc.rb +30 -12
  2. data/lib/geordi/version.rb +1 -1
  3. metadata +3 -3
data/lib/geordi/cuc.rb CHANGED
@@ -41,11 +41,12 @@ module Geordi
41
41
  gem 'parallel_tests', parallel_tests_version
42
42
  require 'parallel_tests'
43
43
  type_arg = Gem::Version.new(::ParallelTests::VERSION) > Gem::Version.new('0.7.0') ? 'cucumber' : 'features'
44
- features_to_run = command_line_features.join(' ')
45
- features_to_run = 'features' if features_to_run == ""
46
- parallel_tests_args = "#{features_to_run} -t #{type_arg}"
44
+ features_to_run = command_line_features
45
+ features_to_run = find_all_features_recursively('features') if features_to_run.empty?
46
+ features_to_run = features_to_run.join(" ")
47
+ parallel_tests_args = "-t #{type_arg}"
47
48
  cucumber_args = command_line_args.empty? ? '' : "-o '#{escape_shell_args(command_line_args).join(" ")}'"
48
- [use_firefox_for_selenium, 'b parallel_test', parallel_tests_args, cucumber_args].flatten.compact.join(" ")
49
+ [use_firefox_for_selenium, 'b parallel_test', parallel_tests_args, cucumber_args, "-- #{features_to_run}"].flatten.compact.join(" ")
49
50
  end
50
51
 
51
52
 
@@ -91,20 +92,28 @@ module Geordi
91
92
 
92
93
  def command_line_features
93
94
  @command_line_features ||= begin
94
- index = argv.find_index("--") || -1
95
- argv[index + 1 .. -1].map do |file_or_dir|
96
- if File.directory?(file_or_dir)
97
- file_or_dir = Dir.glob(File.join(file_or_dir, "**", "*.feature"))
98
- end
99
- file_or_dir
100
- end.flatten.uniq.compact
95
+ index = argv.find_index("--")
96
+ if index.nil? && argv.first && argv.first[0,1] != "-"
97
+ find_all_features_recursively(argv)
98
+ elsif index
99
+ files_or_dirs = argv[index + 1 .. -1]
100
+ find_all_features_recursively(files_or_dirs)
101
+ else
102
+ []
103
+ end
101
104
  end
102
105
  end
103
106
 
104
107
  def command_line_args
105
108
  @command_line_args ||= begin
106
109
  index = argv.find_index("--")
107
- index ? argv[0 .. index-1] : []
110
+ if index.nil? && argv.first && argv.first[0,1] == "-"
111
+ argv
112
+ elsif index
113
+ argv[0 .. index-1]
114
+ else
115
+ []
116
+ end
108
117
  end
109
118
  end
110
119
 
@@ -126,6 +135,15 @@ module Geordi
126
135
  end
127
136
  end
128
137
 
138
+ def find_all_features_recursively(files_or_dirs)
139
+ Array(files_or_dirs).map do |file_or_dir|
140
+ if File.directory?(file_or_dir)
141
+ file_or_dir = Dir.glob(File.join(file_or_dir, "**", "*.feature"))
142
+ end
143
+ file_or_dir
144
+ end.flatten.uniq.compact
145
+ end
146
+
129
147
  def features_can_run_with_parallel_tests?(features)
130
148
  not features.any?{ |feature| feature.include? ":" }
131
149
  end
@@ -1,3 +1,3 @@
1
1
  module Geordi
2
- VERSION = '0.12.4'
2
+ VERSION = '0.12.5'
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geordi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 39
4
+ hash: 37
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 12
9
- - 4
10
- version: 0.12.4
9
+ - 5
10
+ version: 0.12.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch