lucid 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +2 -0
- data/HISTORY.md +8 -0
- data/LICENSE +3 -0
- data/README.md +11 -2
- data/Rakefile +10 -1
- data/lib/autotest/discover.rb +5 -5
- data/lib/autotest/lucid_mixin.rb +34 -35
- data/lib/lucid/ast/table.rb +5 -4
- data/lib/lucid/cli/configuration.rb +0 -6
- data/lib/lucid/cli/options.rb +3 -12
- data/lib/lucid/formatter/condensed.rb +46 -0
- data/lib/lucid/formatter/html.rb +9 -3
- data/lib/lucid/formatter/junit.rb +6 -8
- data/lib/lucid/formatter/standard.rb +1 -7
- data/lib/lucid/generators/project/events-symbiont.rb +1 -1
- data/lib/lucid/platform.rb +1 -1
- data/lib/lucid/runtime.rb +1 -1
- data/lib/lucid/sequence.rb +5 -0
- data/lib/lucid/sequence/sequence_errors.rb +64 -0
- data/lib/lucid/sequence/sequence_group.rb +35 -0
- data/lib/lucid/sequence/sequence_phrase.rb +166 -0
- data/lib/lucid/sequence/sequence_steps.rb +20 -0
- data/lib/lucid/sequence/sequence_support.rb +26 -0
- data/lib/lucid/sequence/sequence_template.rb +354 -0
- data/lib/lucid/spec_file.rb +3 -1
- data/lib/lucid/step_match.rb +1 -1
- data/lib/lucid/wire_support/wire_packet.rb +1 -1
- data/lucid.gemspec +11 -9
- data/spec/lucid/app_spec.rb +42 -0
- data/spec/lucid/configuration_spec.rb +112 -0
- data/spec/lucid/sequences/sequence_conditional_spec.rb +74 -0
- data/spec/lucid/sequences/sequence_group_spec.rb +55 -0
- data/spec/lucid/sequences/sequence_phrase_spec.rb +122 -0
- data/spec/lucid/sequences/sequence_placeholder_spec.rb +56 -0
- data/spec/lucid/sequences/sequence_section_spec.rb +61 -0
- data/spec/lucid/sequences/sequence_support_spec.rb +65 -0
- data/spec/lucid/sequences/sequence_template_spec.rb +298 -0
- data/spec/spec_helper.rb +13 -0
- metadata +86 -54
- data/.rspec +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 917611903e891a6a27b4dce03e92437edb07ceaa
|
4
|
+
data.tar.gz: cdef90026f8bc2071096a02b91cccf652ca30231
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a3ec2d6be6b9e3090c9a76ffb8bc42c81424978762aa2145d995dbdb5831f0dafff8df606863006e9520a14a9099994b5aee7982cc996f1de9ef70d3b19c1e0
|
7
|
+
data.tar.gz: 83cc3a91752a0bc0ce7d8fd81c3092c919fdf14473b1e0f760738cd5bab6ab7d880b801c3a08e8d3cf48a9f00fe05c0e628d4683ef4b0934cfb8f2434f9babce
|
data/Gemfile
CHANGED
data/HISTORY.md
CHANGED
@@ -2,6 +2,14 @@ Change Log and History
|
|
2
2
|
======================
|
3
3
|
|
4
4
|
|
5
|
+
Version 0.2.0 / 2013-09-28
|
6
|
+
--------------------------
|
7
|
+
|
8
|
+
This release introduces a fairly major change, which is that of sequences. The idea is that you can define sequence phrases that are used to stand in for a set of steps. That set of steps is the sequence. This is essentially a macro-like functionality for Lucid. It's uncertain how long this functionality will exist since it potentially harbors some questionable design choices when it comes to an expressive TDL.
|
9
|
+
|
10
|
+
This release also introduces a new formatter called "condensed." This formatter is used simply to display a much more limited set of information about the scenarios that are being executed. Specifically, all that gets returned are the scenario titles, essentially hiding all of the steps. Pass/fail information is still reported.
|
11
|
+
|
12
|
+
|
5
13
|
Version 0.1.1 / 2013-06-04
|
6
14
|
--------------------------
|
7
15
|
|
data/LICENSE
CHANGED
@@ -5,6 +5,9 @@ Copyright (c) 2012, 2013 Jeff Nyman
|
|
5
5
|
Any Cucumber-derived elements
|
6
6
|
Copyright (c) 2008,2009,2010,2011,2012,2013 Aslak Hellesøy and contributors.
|
7
7
|
|
8
|
+
Sequence functionality derived from Macros4Cuke
|
9
|
+
Copyright (c) 2013, Dimitri Geshef.
|
10
|
+
|
8
11
|
Permission is hereby granted, free of charge, to any person obtaining
|
9
12
|
a copy of this software and associated documentation files (the
|
10
13
|
"Software"), to deal in the Software without restriction, including
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Lucid
|
2
2
|
=====
|
3
3
|
|
4
|
+
[![Build Status](https://secure.travis-ci.org/jnyman/lucid.png)](http://travis-ci.org/jnyman/lucid)
|
5
|
+
[![Dependency Status](https://gemnasium.com/jnyman/lucid.png)](https://gemnasium.com/jnyman/lucid)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/lucid.png)](http://badge.fury.io/rb/lucid)
|
7
|
+
[![Coverage Status](https://coveralls.io/repos/jnyman/lucid/badge.png?branch=master)](https://coveralls.io/r/jnyman/lucid)
|
8
|
+
|
4
9
|
Description
|
5
10
|
-----------
|
6
11
|
|
@@ -42,8 +47,12 @@ You should also check out some of my [blog posts related to Lucid](http://tester
|
|
42
47
|
Contributing
|
43
48
|
------------
|
44
49
|
|
45
|
-
|
50
|
+
[Suggest an Improvement](https://github.com/jnyman/lucid/issues) or [Report a Bug](https://github.com/jnyman/lucid/issues)
|
51
|
+
|
52
|
+
To work on Lucid:
|
53
|
+
|
54
|
+
1. Fork the project.
|
46
55
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
47
56
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
48
57
|
4. Push to the branch (`git push origin my-new-feature`)
|
49
|
-
5. Create new
|
58
|
+
5. Create a new [pull request](https://help.github.com/articles/using-pull-requests)
|
data/Rakefile
CHANGED
@@ -1,2 +1,11 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
|
-
require
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new do |c|
|
6
|
+
options = ['--color']
|
7
|
+
options += ['--format', 'documentation']
|
8
|
+
c.rspec_opts = options
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :spec
|
data/lib/autotest/discover.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
Autotest.add_discovery do
|
2
|
-
if File.directory?('
|
3
|
-
if ENV['
|
4
|
-
|
5
|
-
elsif ENV['
|
2
|
+
if File.directory?('specs')
|
3
|
+
if ENV['AUTOSPEC'] =~ /true/i
|
4
|
+
'lucid'
|
5
|
+
elsif ENV['AUTOSPEC'] =~ /false/i
|
6
6
|
# noop
|
7
7
|
else
|
8
|
-
puts
|
8
|
+
puts '(Not running specs. To run specs in autotest, set AUTOSPEC=true.)'
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/autotest/lucid_mixin.rb
CHANGED
@@ -5,71 +5,71 @@ require 'lucid/cli/profile'
|
|
5
5
|
|
6
6
|
module Autotest::LucidMixin
|
7
7
|
def self.included(receiver)
|
8
|
-
receiver::ALL_HOOKS << [:
|
8
|
+
receiver::ALL_HOOKS << [:run_specs, :ran_specs]
|
9
9
|
end
|
10
10
|
|
11
|
-
attr_accessor :
|
11
|
+
attr_accessor :specs_to_run
|
12
12
|
|
13
13
|
def initialize
|
14
14
|
super
|
15
|
-
|
15
|
+
reset_specs
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
19
|
hook :initialize
|
20
20
|
reset
|
21
|
-
|
21
|
+
reset_specs
|
22
22
|
add_sigint_handler
|
23
23
|
|
24
24
|
self.last_mtime = Time.now if $f
|
25
25
|
|
26
|
-
loop do
|
26
|
+
loop do
|
27
27
|
begin
|
28
28
|
get_to_green
|
29
29
|
if self.tainted then
|
30
30
|
rerun_all_tests
|
31
|
-
|
31
|
+
rerun_all_specs if all_good
|
32
32
|
else
|
33
33
|
hook :all_good
|
34
34
|
end
|
35
35
|
wait_for_changes
|
36
|
-
# Once tests and
|
37
|
-
# time a file is changed to see if anything breaks.
|
38
|
-
|
36
|
+
# Once tests and specs are running green, this should reset specs
|
37
|
+
# every time a file is changed to see if anything breaks.
|
38
|
+
reset_specs
|
39
39
|
rescue Interrupt
|
40
40
|
break if self.wants_to_quit
|
41
41
|
reset
|
42
|
-
|
42
|
+
reset_specs
|
43
43
|
end
|
44
44
|
end
|
45
45
|
hook :quit
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
49
|
-
|
48
|
+
def all_specs_good
|
49
|
+
specs_to_run == ""
|
50
50
|
end
|
51
51
|
|
52
52
|
def get_to_green
|
53
53
|
begin
|
54
54
|
super
|
55
|
-
|
56
|
-
wait_for_changes unless
|
57
|
-
end until
|
55
|
+
run_specs
|
56
|
+
wait_for_changes unless all_specs_good
|
57
|
+
end until all_specs_good
|
58
58
|
end
|
59
59
|
|
60
|
-
def
|
61
|
-
|
62
|
-
|
60
|
+
def rerun_all_specs
|
61
|
+
reset_specs
|
62
|
+
run_specs
|
63
63
|
end
|
64
64
|
|
65
|
-
def
|
66
|
-
self.
|
65
|
+
def reset_specs
|
66
|
+
self.specs_to_run = :all
|
67
67
|
end
|
68
68
|
|
69
|
-
def
|
70
|
-
hook :
|
71
|
-
Tempfile.open('autotest-lucid') do |
|
72
|
-
cmd = self.make_lucid_cmd(self.
|
69
|
+
def run_specs
|
70
|
+
hook :run_specs
|
71
|
+
Tempfile.open('autotest-lucid') do |dirty_specs_file|
|
72
|
+
cmd = self.make_lucid_cmd(self.specs_to_run, dirty_specs_file.path)
|
73
73
|
return if cmd.empty?
|
74
74
|
puts cmd unless $q
|
75
75
|
old_sync = $stdout.sync
|
@@ -99,32 +99,31 @@ module Autotest::LucidMixin
|
|
99
99
|
ensure
|
100
100
|
$stdout.sync = old_sync
|
101
101
|
end
|
102
|
-
self.
|
103
|
-
self.tainted = true unless self.
|
102
|
+
self.specs_to_run = dirty_specs_file.read.strip
|
103
|
+
self.tainted = true unless self.specs_to_run == ''
|
104
104
|
end
|
105
|
-
hook :
|
105
|
+
hook :ran_specs
|
106
106
|
end
|
107
107
|
|
108
|
-
def make_lucid_cmd(
|
109
|
-
return '' if
|
108
|
+
def make_lucid_cmd(specs_to_run, dirty_specs_filename)
|
109
|
+
return '' if specs_to_run == ''
|
110
110
|
|
111
111
|
profile_loader = Lucid::CLI::Profile.new
|
112
112
|
|
113
|
-
profile ||= "autotest-all" if profile_loader.has_profile?("autotest-all") &&
|
113
|
+
profile ||= "autotest-all" if profile_loader.has_profile?("autotest-all") && specs_to_run == :all
|
114
114
|
profile ||= "autotest" if profile_loader.has_profile?("autotest")
|
115
115
|
profile ||= nil
|
116
116
|
|
117
117
|
if profile
|
118
118
|
args = ["--profile", profile]
|
119
119
|
else
|
120
|
-
args = %w{--format} << (
|
120
|
+
args = %w{--format} << (specs_to_run == :all ? "progress" : "standard")
|
121
121
|
end
|
122
122
|
# No --color option as some IDEs (Netbeans) don't output them very well ([31m1 failed step[0m)
|
123
|
-
args += %w{--format rerun --out} <<
|
124
|
-
args << (
|
123
|
+
args += %w{--format rerun --out} << dirty_specs_filename
|
124
|
+
args << (specs_to_run == :all ? "" : specs_to_run)
|
125
125
|
|
126
|
-
|
127
|
-
unless features_to_run == :all
|
126
|
+
unless specs_to_run == :all
|
128
127
|
args << 'steps' << 'common'
|
129
128
|
end
|
130
129
|
|
data/lib/lucid/ast/table.rb
CHANGED
@@ -242,10 +242,11 @@ module Lucid
|
|
242
242
|
end
|
243
243
|
|
244
244
|
# Returns a new Table where the headers are redefined. See #map_headers!
|
245
|
-
def map_headers(mappings={})
|
246
|
-
table = self.dup
|
247
|
-
table.map_headers!(mappings)
|
248
|
-
table
|
245
|
+
def map_headers(mappings={}, &block)
|
246
|
+
#table = self.dup
|
247
|
+
#table.map_headers!(mappings)
|
248
|
+
#table
|
249
|
+
self.class.new raw.dump, @conversion_procs.dup, mappings, block
|
249
250
|
end
|
250
251
|
|
251
252
|
# Change how #hashes converts column values. The +column_name+ argument identifies the column
|
@@ -186,12 +186,6 @@ module Lucid
|
|
186
186
|
end
|
187
187
|
|
188
188
|
def formatters(runtime)
|
189
|
-
# TODO: Remove the autoformat functionality; use the Gherkin CLI instead.
|
190
|
-
if @options[:autoformat]
|
191
|
-
require 'lucid/formatter/standard'
|
192
|
-
return [Formatter::Standard.new(runtime, nil, @options)]
|
193
|
-
end
|
194
|
-
|
195
189
|
@options[:formats].map do |format|
|
196
190
|
# The name will be a name, like 'standard'. The route will be the
|
197
191
|
# location where output is sent to, such as 'STDOUT'.
|
data/lib/lucid/cli/options.rb
CHANGED
@@ -10,6 +10,7 @@ module Lucid
|
|
10
10
|
LUCID_FORMATS = {
|
11
11
|
'html' => ['Lucid::Formatter::Html', 'Generates an HTML report.'],
|
12
12
|
'standard' => ['Lucid::Formatter::Standard', 'Prints the spec as-is, using color if available.'],
|
13
|
+
'condensed' => ['Lucid::Formatter::Condensed', 'Output only spec file and scenarios.'],
|
13
14
|
'progress' => ['Lucid::Formatter::Progress', 'Prints one character per scenario.'],
|
14
15
|
'rerun' => ['Lucid::Formatter::Rerun', 'Prints failing specs with line numbers.'],
|
15
16
|
'usage' => ['Lucid::Formatter::Usage', "Prints where test definitions are used.\n" +
|
@@ -27,7 +28,7 @@ module Lucid
|
|
27
28
|
largest = LUCID_FORMATS.keys.map{|s| s.length}.max
|
28
29
|
FORMAT_LIST = (LUCID_FORMATS.keys.sort.map do |key|
|
29
30
|
" #{key}#{' ' * (largest - key.length)} : #{LUCID_FORMATS[key][1]}"
|
30
|
-
end) + ["Use --format rerun --out
|
31
|
+
end) + ["Use --format rerun --out rerun.txt to write out failing",
|
31
32
|
"specs. You can rerun them with lucid @rerun.txt.",
|
32
33
|
"FORMAT can also be the fully qualified class name of",
|
33
34
|
"your own custom formatter. If the class isn't loaded,",
|
@@ -46,7 +47,7 @@ module Lucid
|
|
46
47
|
OPTIONS_WITH_ARGS = ['-r', '--require', '--i18n', '-f', '--format', '-o', '--out',
|
47
48
|
'-t', '--tags', '-n', '--name', '-e', '--exclude',
|
48
49
|
PROFILE_SHORT_FLAG, PROFILE_LONG_FLAG,
|
49
|
-
'
|
50
|
+
'--lines', '--port',
|
50
51
|
'-I', '--matcher-type']
|
51
52
|
|
52
53
|
def self.parse(args, out_stream, error_stream, options = {})
|
@@ -210,16 +211,6 @@ module Lucid
|
|
210
211
|
Lucid::Term::ANSIColor.coloring = v
|
211
212
|
end
|
212
213
|
|
213
|
-
opts.on("-a", "--autoformat DIR",
|
214
|
-
"Reformats (pretty prints) spec files and write them to DIRECTORY.",
|
215
|
-
"Be careful if you choose to overwrite the originals.",
|
216
|
-
"Implies --dry-run --format pretty.") do |directory|
|
217
|
-
@options[:autoformat] = directory
|
218
|
-
Lucid::Term::ANSIColor.coloring = false
|
219
|
-
@options[:dry_run] = true
|
220
|
-
@quiet = true
|
221
|
-
end
|
222
|
-
|
223
214
|
opts.on("-m", "--no-multiline",
|
224
215
|
"Lucid will not print multiline strings and tables under steps.") do
|
225
216
|
@options[:no_multiline] = true
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'lucid/formatter/standard'
|
2
|
+
|
3
|
+
module Lucid
|
4
|
+
module Formatter
|
5
|
+
class Condensed < Lucid::Formatter::Standard
|
6
|
+
|
7
|
+
def scenario_name(keyword, name, file_colon_line, source_indent)
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def feature_name(keyword, name)
|
12
|
+
name = name.split(/\n/)[0]
|
13
|
+
@io.puts("#{keyword}: #{name}")
|
14
|
+
@io.flush
|
15
|
+
end
|
16
|
+
|
17
|
+
def background_name(*args)
|
18
|
+
return
|
19
|
+
end
|
20
|
+
|
21
|
+
def before_step( step )
|
22
|
+
@io.print "\r... #{step.name}"
|
23
|
+
@io.flush
|
24
|
+
end
|
25
|
+
|
26
|
+
def after_step( step )
|
27
|
+
@io.print " "*(step.name.length+4)
|
28
|
+
@io.flush
|
29
|
+
end
|
30
|
+
|
31
|
+
def before_step_result( *args )
|
32
|
+
@io.printf "\r"
|
33
|
+
super
|
34
|
+
end
|
35
|
+
|
36
|
+
def step_name(*args)
|
37
|
+
@hide_this_step=true if args[2] == :passed
|
38
|
+
super
|
39
|
+
end
|
40
|
+
|
41
|
+
def comment_line(comment_line)
|
42
|
+
return
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
data/lib/lucid/formatter/html.rb
CHANGED
@@ -22,6 +22,7 @@ module Lucid
|
|
22
22
|
@header_red = nil
|
23
23
|
@delayed_messages = []
|
24
24
|
@img_id = 0
|
25
|
+
@inside_outline = false
|
25
26
|
end
|
26
27
|
|
27
28
|
def embed(src, mime_type, label)
|
@@ -171,8 +172,10 @@ module Lucid
|
|
171
172
|
end
|
172
173
|
|
173
174
|
def before_outline_table(outline_table)
|
175
|
+
@inside_outline = true
|
174
176
|
@outline_row = 0
|
175
177
|
@builder << '<table>'
|
178
|
+
@inside_outline = false
|
176
179
|
end
|
177
180
|
|
178
181
|
def after_outline_table(outline_table)
|
@@ -257,6 +260,7 @@ module Lucid
|
|
257
260
|
end
|
258
261
|
|
259
262
|
def exception(exception, status)
|
263
|
+
return if @hide_this_step
|
260
264
|
build_exception_detail(exception)
|
261
265
|
end
|
262
266
|
|
@@ -325,7 +329,7 @@ module Lucid
|
|
325
329
|
attributes = {:id => "#{@row_id}_#{@col_index}", :class => 'step'}
|
326
330
|
attributes[:class] += " #{status}" if status
|
327
331
|
build_cell(@cell_type, value, attributes)
|
328
|
-
set_scenario_color(status)
|
332
|
+
set_scenario_color(status) if @inside_outline
|
329
333
|
@col_index += 1
|
330
334
|
end
|
331
335
|
|
@@ -405,7 +409,8 @@ module Lucid
|
|
405
409
|
@builder.script do
|
406
410
|
@builder.text!("makeRed('lucid-header');") unless @header_red
|
407
411
|
@header_red = true
|
408
|
-
@
|
412
|
+
scenario_or_background = @in_background ? "background" : "scenario"
|
413
|
+
@builder.text!("makeRed('#{scenario_or_background}_#{@scenario_number}');") unless @scenario_red
|
409
414
|
@scenario_red = true
|
410
415
|
end
|
411
416
|
end
|
@@ -413,7 +418,8 @@ module Lucid
|
|
413
418
|
def set_scenario_color_pending
|
414
419
|
@builder.script do
|
415
420
|
@builder.text!("makeYellow('lucid-header');") unless @header_red
|
416
|
-
@
|
421
|
+
scenario_or_background = @in_background ? "background" : "scenario"
|
422
|
+
@builder.text!("makeYellow('#{scenario_or_background}_#{@scenario_number}');") unless @scenario_red
|
417
423
|
end
|
418
424
|
end
|
419
425
|
|
@@ -130,21 +130,19 @@ module Lucid
|
|
130
130
|
@time += duration
|
131
131
|
classname = @feature_name
|
132
132
|
name = "#{@scenario}#{suffix}"
|
133
|
-
pending = [:pending, :undefined].include?(status)
|
134
|
-
|
135
|
-
|
133
|
+
pending = [:pending, :undefined].include?(status) && ( !@options[:strict])
|
134
|
+
|
136
135
|
@builder.testcase(:classname => classname, :name => name, :time => "%.6f" % duration) do
|
137
|
-
|
136
|
+
if status == :skipped || pending
|
137
|
+
@builder.skipped
|
138
|
+
@skipped += 1
|
139
|
+
elsif status != :passed
|
138
140
|
@builder.failure(:message => "#{status.to_s} #{name}", :type => status.to_s) do
|
139
141
|
@builder.cdata! @output
|
140
142
|
@builder.cdata!(format_exception(exception)) if exception
|
141
143
|
end
|
142
144
|
@failures += 1
|
143
145
|
end
|
144
|
-
if passed and (status == :skipped || pending)
|
145
|
-
@builder.skipped
|
146
|
-
@skipped += 1
|
147
|
-
end
|
148
146
|
@builder.tag!('system-out')
|
149
147
|
@builder.tag!('system-err')
|
150
148
|
end
|
@@ -27,18 +27,12 @@ module Lucid
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def after_features(features)
|
30
|
-
print_summary(features)
|
30
|
+
print_summary(features)
|
31
31
|
end
|
32
32
|
|
33
33
|
def before_feature(feature)
|
34
34
|
@exceptions = []
|
35
35
|
@indent = 0
|
36
|
-
if @options[:autoformat]
|
37
|
-
file = File.join(@options[:autoformat], feature.file)
|
38
|
-
dir = File.dirname(file)
|
39
|
-
mkdir_p(dir) unless File.directory?(dir)
|
40
|
-
@io = ensure_file(file, "standard")
|
41
|
-
end
|
42
36
|
end
|
43
37
|
|
44
38
|
def comment_line(comment_line)
|