lucid 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Lucid
17
17
  "#{INDENT}listed first. If --dry-run is used the duration\n" +
18
18
  "#{INDENT}is not shown, and test definitions are sorted by\n" +
19
19
  "#{INDENT}file name instead."],
20
- 'stepdefs' => ['Lucid::Formatter::Stepdefs', "Prints all test definitions with their locations. Same as\n" +
20
+ 'testdefs' => ['Lucid::Formatter::Testdefs', "Prints all test definitions with their locations. Same as\n" +
21
21
  "#{INDENT}the usage formatter, except that steps are not printed."],
22
22
  'junit' => ['Lucid::Formatter::Junit', 'Generates a report similar to Ant+JUnit.'],
23
23
  'json' => ['Lucid::Formatter::Json', 'Prints the spec as JSON.'],
@@ -94,6 +94,10 @@ module Lucid
94
94
  @options[:spec_type] = type
95
95
  end
96
96
 
97
+ opts.on("--driver-file FILE", "The file for Lucid to connect to an execution library.") do |file|
98
+ @options[:driver_file] = file
99
+ end
100
+
97
101
  opts.separator ""
98
102
 
99
103
  opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
@@ -436,6 +440,8 @@ module Lucid
436
440
  @options[:strict] |= other_options[:strict]
437
441
  @options[:dry_run] |= other_options[:dry_run]
438
442
 
443
+ @options[:library_path] += other_options[:library_path]
444
+
439
445
  @profiles += other_options.profiles
440
446
  @expanded_args += other_options.expanded_args
441
447
 
@@ -463,17 +469,18 @@ module Lucid
463
469
 
464
470
  def default_options
465
471
  {
466
- :strict => false,
467
- :require => [],
468
- :dry_run => false,
469
- :formats => [],
470
- :excludes => [],
472
+ :strict => false,
473
+ :require => [],
474
+ :dry_run => false,
475
+ :formats => [],
476
+ :excludes => [],
471
477
  :tag_expressions => [],
472
- :name_regexps => [],
473
- :env_vars => {},
474
- :diff_enabled => true,
475
- :spec_type => "",
476
- :library_path => ""
478
+ :name_regexps => [],
479
+ :env_vars => {},
480
+ :diff_enabled => true,
481
+ :spec_type => "",
482
+ :library_path => "",
483
+ :driver_file => ""
477
484
  }
478
485
  end
479
486
  end
@@ -47,9 +47,9 @@ module Lucid
47
47
  @step_time = Time.now
48
48
  end
49
49
 
50
- def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
51
- arguments = step_match.step_arguments.map{|a| Gherkin::Formatter::Argument.new(a.offset, a.val)}
52
- location = step_match.file_colon_line
50
+ def before_step_result(step_result)
51
+ arguments = step_result.step_arguments.map{|a| Gherkin::Formatter::Argument.new(a.offset, a.val)}
52
+ location = step_result.step_match.file_colon_line
53
53
  match = Gherkin::Formatter::Model::Match.new(arguments, location)
54
54
  if @print_empty_match
55
55
  # Trick the formatter to believe that's what was printed previously so we get arg highlights on #result
@@ -58,9 +58,10 @@ module Lucid
58
58
  @gf.match(match)
59
59
  end
60
60
 
61
+ exception = step_result.exception
61
62
  error_message = exception ? "#{exception.message} (#{exception.class})\n#{exception.backtrace.join("\n")}" : nil
62
63
  unless @outline
63
- @gf.result(Gherkin::Formatter::Model::Result.new(status, nil, error_message))
64
+ @gf.result(Gherkin::Formatter::Model::Result.new(step_result.status, nil, error_message))
64
65
  end
65
66
  end
66
67
 
@@ -214,33 +214,33 @@ module Lucid
214
214
  move_progress
215
215
  end
216
216
 
217
- def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
218
- @step_match = step_match
217
+ def before_step_result(step_result)
218
+ @step_match = step_result.step_match
219
219
  @hide_this_step = false
220
- if exception
221
- if @exceptions.include?(exception)
220
+ if step_result.exception
221
+ if @exceptions.include?(step_result.exception)
222
222
  @hide_this_step = true
223
223
  return
224
224
  end
225
- @exceptions << exception
225
+ @exceptions << step_result.exception
226
226
  end
227
- if status != :failed && @in_background ^ background
227
+ if step_result.status != :failed && @in_background ^ step_result.background
228
228
  @hide_this_step = true
229
229
  return
230
230
  end
231
- @status = status
231
+ @status = step_result.status
232
232
  return if @hide_this_step
233
- set_scenario_color(status)
234
- @builder << "<li id='#{@step_id}' class='step #{status}'>"
233
+ set_scenario_color(step_result.status)
234
+ @builder << "<li id='#{@step_id}' class='step #{step_result.status}'>"
235
235
  end
236
236
 
237
- def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
237
+ def after_step_result(step_result)
238
238
  return if @hide_this_step
239
- if status == :undefined
239
+ if step_result.status == :undefined
240
240
  keyword = @step.actual_keyword if @step.respond_to?(:actual_keyword)
241
241
  step_multiline_class = @step.multiline_arg ? @step.multiline_arg.class : nil
242
242
  @builder.pre do |pre|
243
- pre << @runtime.matcher_text(keyword,step_match.instance_variable_get("@name") || '',step_multiline_class)
243
+ pre << @runtime.matcher_text(keyword,step_result.step_name || '',step_result.step_multiline_class)
244
244
  end
245
245
  end
246
246
  @builder << '</li>'
@@ -40,9 +40,9 @@ module Lucid
40
40
  @exception_raised = false
41
41
  end
42
42
 
43
- def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
44
- progress(status)
45
- @status = status
43
+ def after_step_result(step_result)
44
+ progress(step_result.status)
45
+ @status = step_result.status
46
46
  end
47
47
 
48
48
  def before_outline_table(outline_table)
@@ -127,20 +127,20 @@ module Lucid
127
127
  @indent = 6
128
128
  end
129
129
 
130
- def before_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
130
+ def before_step_result(step_result)
131
131
  @hide_this_step = false
132
- if exception
133
- if @exceptions.include?(exception)
132
+ if step_result.exception
133
+ if @exceptions.include?(step_result.exception)
134
134
  @hide_this_step = true
135
135
  return
136
136
  end
137
- @exceptions << exception
137
+ @exceptions << step_result.exception
138
138
  end
139
- if status != :failed && @in_background ^ background
139
+ if step_result.status != :failed && @in_background ^ step_result.background
140
140
  @hide_this_step = true
141
141
  return
142
142
  end
143
- @status = status
143
+ @status = step_result.status
144
144
  end
145
145
 
146
146
  def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
@@ -2,7 +2,7 @@ require 'lucid/formatter/usage'
2
2
 
3
3
  module Lucid
4
4
  module Formatter
5
- class Stepdefs < Usage
5
+ class Testdefs < Usage
6
6
  def print_steps(stepdef_key)
7
7
  end
8
8
 
@@ -26,19 +26,19 @@ module Lucid
26
26
  @start_time = Time.now
27
27
  end
28
28
 
29
- def before_step_result(*args)
29
+ def before_step_result(step_result)
30
30
  @duration = Time.now - @start_time
31
31
  end
32
32
 
33
- def after_step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background, file_colon_line)
34
- step_definition = step_match.step_definition
33
+ def after_step_result(step_result)
34
+ step_definition = step_result.step_definition
35
35
  unless step_definition.nil? # nil if it's from a scenario outline
36
36
  stepdef_key = StepDefKey.new(step_definition.regexp_source, step_definition.file_colon_line)
37
37
 
38
38
  @stepdef_to_match[stepdef_key] << {
39
- :keyword => keyword,
40
- :step_match => step_match,
41
- :status => status,
39
+ :keyword => step_result.keyword,
40
+ :step_match => step_result.step_match,
41
+ :status => step_result.status,
42
42
  :file_colon_line => @step.file_colon_line,
43
43
  :duration => @duration
44
44
  }
@@ -77,12 +77,6 @@ module Lucid
77
77
  @__lucid_runtime.doc_string(string_without_triple_quotes, content_type, line_offset)
78
78
  end
79
79
 
80
- # @deprecated Use {#puts} instead.
81
- def announce(*messages)
82
- STDERR.puts AnsiEscapes.failed + "WARNING: #announce is deprecated. Use #puts instead:" + caller[0] + AnsiEscapes.reset
83
- puts(*messages)
84
- end
85
-
86
80
  # Print a message to the output.
87
81
  #
88
82
  # @note Lucid might surprise you with the behavior of this method. Instead
@@ -2,7 +2,7 @@ require 'rbconfig'
2
2
 
3
3
  module Lucid
4
4
  unless defined?(Lucid::VERSION)
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'
6
6
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/lucid')
7
7
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
8
8
  JRUBY = defined?(JRUBY_VERSION)
data/lib/lucid/runtime.rb CHANGED
@@ -26,7 +26,7 @@ module Lucid
26
26
  @results = Results.new(@configuration)
27
27
  end
28
28
 
29
- # Allows you to take an existing runtime and change it's configuration
29
+ # Used to take an existing runtime and change its configuration.
30
30
  def configure(new_configuration)
31
31
  @configuration = Configuration.parse(new_configuration)
32
32
  @orchestrator.configure(@configuration)
@@ -42,9 +42,9 @@ module Lucid
42
42
  fire_after_configuration_hook
43
43
 
44
44
  tdl_walker = @configuration.establish_tdl_walker(self)
45
- self.visitor = tdl_walker # Ugly circular dependency, but needed to support Domain#puts
45
+ self.visitor = tdl_walker
46
46
 
47
- tdl_walker.visit_features(specs)
47
+ specs.accept(tdl_walker)
48
48
  end
49
49
 
50
50
  def features_paths
@@ -120,13 +120,13 @@ module Lucid
120
120
  @orchestrator.unknown_programming_language?
121
121
  end
122
122
 
123
- def write_stepdefs_json
123
+ def write_testdefs_json
124
124
  if(@configuration.testdefs)
125
125
  stepdefs = []
126
126
  @orchestrator.step_definitions.sort{|a,b| a.to_hash['source'] <=> a.to_hash['source']}.each do |stepdef|
127
127
  stepdef_hash = stepdef.to_hash
128
128
  steps = []
129
- features.each do |feature|
129
+ specs.each do |feature|
130
130
  feature.feature_elements.each do |feature_element|
131
131
  feature_element.raw_steps.each do |step|
132
132
  args = stepdef.arguments_from(step.name)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-09 00:00:00.000000000 Z
12
+ date: 2013-05-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -171,6 +171,7 @@ files:
171
171
  - lib/lucid/ast/step.rb
172
172
  - lib/lucid/ast/step_collection.rb
173
173
  - lib/lucid/ast/step_invocation.rb
174
+ - lib/lucid/ast/step_result.rb
174
175
  - lib/lucid/ast/table.rb
175
176
  - lib/lucid/ast/tags.rb
176
177
  - lib/lucid/ast/tdl_walker.rb
@@ -204,9 +205,9 @@ files:
204
205
  - lib/lucid/formatter/progress.rb
205
206
  - lib/lucid/formatter/rerun.rb
206
207
  - lib/lucid/formatter/standard.rb
207
- - lib/lucid/formatter/stepdefs.rb
208
208
  - lib/lucid/formatter/steps.rb
209
209
  - lib/lucid/formatter/summary.rb
210
+ - lib/lucid/formatter/testdefs.rb
210
211
  - lib/lucid/formatter/unicode.rb
211
212
  - lib/lucid/formatter/usage.rb
212
213
  - lib/lucid/generator.rb
@@ -259,7 +260,7 @@ homepage: https://github.com/jnyman/lucid
259
260
  licenses:
260
261
  - MIT
261
262
  post_install_message: ! "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
262
- (::)\n\n Thanks for installing Lucid 0.0.6.\n\n(::) (::) (::) (::) (::) (::) (::)
263
+ (::)\n\n Thanks for installing Lucid 0.0.7.\n\n(::) (::) (::) (::) (::) (::) (::)
263
264
  (::) (::) (::) (::) (::)\n "
264
265
  rdoc_options:
265
266
  - --charset=UTF-8
@@ -282,6 +283,6 @@ rubyforge_project:
282
283
  rubygems_version: 1.8.24
283
284
  signing_key:
284
285
  specification_version: 3
285
- summary: lucid-0.0.6
286
+ summary: lucid-0.0.7
286
287
  test_files: []
287
288
  has_rdoc: