lucid 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +8 -0
- data/README.md +2 -0
- data/lib/lucid/ast.rb +1 -0
- data/lib/lucid/ast/background.rb +3 -2
- data/lib/lucid/ast/comment.rb +0 -1
- data/lib/lucid/ast/doc_string.rb +0 -1
- data/lib/lucid/ast/empty_background.rb +2 -2
- data/lib/lucid/ast/examples.rb +0 -2
- data/lib/lucid/ast/feature.rb +0 -2
- data/lib/lucid/ast/outline_table.rb +3 -6
- data/lib/lucid/ast/scenario.rb +25 -15
- data/lib/lucid/ast/scenario_outline.rb +3 -4
- data/lib/lucid/ast/specs.rb +0 -2
- data/lib/lucid/ast/step.rb +0 -1
- data/lib/lucid/ast/step_collection.rb +1 -30
- data/lib/lucid/ast/step_invocation.rb +0 -2
- data/lib/lucid/ast/step_invocations.rb +73 -0
- data/lib/lucid/ast/table.rb +0 -4
- data/lib/lucid/ast/tags.rb +0 -1
- data/lib/lucid/ast/tdl_walker.rb +1 -7
- data/lib/lucid/generators/project/browser-symbiont.rb +2 -1
- data/lib/lucid/generators/project/lucid-symbiont.yml +2 -2
- data/lib/lucid/platform.rb +1 -1
- metadata +5 -4
data/HISTORY.md
CHANGED
@@ -2,6 +2,14 @@ Change Log and History
|
|
2
2
|
======================
|
3
3
|
|
4
4
|
|
5
|
+
Version 0.1.0 / 2013-06-02
|
6
|
+
--------------------------
|
7
|
+
|
8
|
+
The main focus of this release is some back end changes to simplify and speed up Lucid operation. Of particular note, this release has modified the Lucid Symbiont project that gets generated from the lucid-gen tool. There were errors in that project that made working with browsers problematic.
|
9
|
+
|
10
|
+
Lucid is now entering its "initial development phase", notwithstanding the fact that Lucid has already been in initial development. At this point Lucid has proven stable enough to write a series of blog articles on describing how to use it. That, for the time being, is serving as the "public API" or reference implementation. Upcoming releases will more often than not be focusing on feature inclusion as opposed to small updates and internal fixes.
|
11
|
+
|
12
|
+
|
5
13
|
Version 0.0.9 / 2013-05-22
|
6
14
|
--------------------------
|
7
15
|
|
data/README.md
CHANGED
@@ -36,6 +36,8 @@ In order to to check what options are available to you from the command line, do
|
|
36
36
|
|
37
37
|
$ lucid --help
|
38
38
|
|
39
|
+
You should also check out some of my [blog posts related to Lucid](http://testerstories.com/?cat=24). They will take you through workflows of using the tool.
|
40
|
+
|
39
41
|
|
40
42
|
Contributing
|
41
43
|
------------
|
data/lib/lucid/ast.rb
CHANGED
@@ -5,6 +5,7 @@ require 'lucid/ast/background'
|
|
5
5
|
require 'lucid/ast/scenario'
|
6
6
|
require 'lucid/ast/scenario_outline'
|
7
7
|
require 'lucid/ast/step_invocation'
|
8
|
+
require 'lucid/ast/step_invocations'
|
8
9
|
require 'lucid/ast/step_collection'
|
9
10
|
require 'lucid/ast/step'
|
10
11
|
require 'lucid/ast/step_result'
|
data/lib/lucid/ast/background.rb
CHANGED
@@ -26,7 +26,7 @@ module Lucid
|
|
26
26
|
@step_invocations ||= steps.step_invocations(true)
|
27
27
|
end
|
28
28
|
|
29
|
-
def
|
29
|
+
def create_step_invocations(scenario_step_invocations)
|
30
30
|
if(@first_collection_created)
|
31
31
|
steps.step_invocations(true).dup(scenario_step_invocations)
|
32
32
|
else
|
@@ -36,7 +36,7 @@ module Lucid
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def accept(visitor)
|
39
|
-
return if
|
39
|
+
return if @already_visited
|
40
40
|
visitor.visit_background(self) do
|
41
41
|
comment.accept(visitor)
|
42
42
|
visitor.visit_background_name(@keyword, name, file_colon_line, source_indent(first_line_length))
|
@@ -48,6 +48,7 @@ module Lucid
|
|
48
48
|
visitor.runtime.after(hook_context) if @failed || feature_elements.empty?
|
49
49
|
end
|
50
50
|
end
|
51
|
+
@already_visited = true
|
51
52
|
end
|
52
53
|
|
53
54
|
def with_visitor(scenario, visitor)
|
data/lib/lucid/ast/comment.rb
CHANGED
data/lib/lucid/ast/doc_string.rb
CHANGED
data/lib/lucid/ast/examples.rb
CHANGED
data/lib/lucid/ast/feature.rb
CHANGED
@@ -30,12 +30,10 @@ module Lucid
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def accept(visitor)
|
33
|
-
return if Lucid.wants_to_quit
|
34
33
|
visitor.visit_feature(self) do
|
35
34
|
comment.accept(visitor)
|
36
35
|
tags.accept(visitor)
|
37
36
|
visitor.visit_feature_name(@keyword, indented_name)
|
38
|
-
background.accept(visitor)
|
39
37
|
@feature_elements.each do |feature_element|
|
40
38
|
feature_element.accept(visitor)
|
41
39
|
end
|
@@ -5,13 +5,12 @@ module Lucid
|
|
5
5
|
super(raw)
|
6
6
|
@scenario_outline = scenario_outline
|
7
7
|
@cells_class = ExampleRow
|
8
|
-
example_rows.each do |
|
9
|
-
|
8
|
+
example_rows.each do |example_row|
|
9
|
+
example_row.create_step_invocations!(scenario_outline)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
13
|
def accept(visitor)
|
14
|
-
return if Lucid.wants_to_quit
|
15
14
|
visitor.visit_outline_table(self) do
|
16
15
|
cells_rows.each do |row|
|
17
16
|
row.accept(visitor)
|
@@ -57,7 +56,7 @@ module Lucid
|
|
57
56
|
end
|
58
57
|
end
|
59
58
|
|
60
|
-
attr_reader :scenario_outline
|
59
|
+
attr_reader :scenario_outline
|
61
60
|
|
62
61
|
def initialize(table, cells)
|
63
62
|
super
|
@@ -84,8 +83,6 @@ module Lucid
|
|
84
83
|
end
|
85
84
|
|
86
85
|
def accept(visitor)
|
87
|
-
return if Lucid.wants_to_quit
|
88
|
-
#visitor.configuration.expand? ? accept_expand(visitor) : accept_plain(visitor)
|
89
86
|
if visitor.configuration.expand?
|
90
87
|
accept_expand(visitor)
|
91
88
|
else
|
data/lib/lucid/ast/scenario.rb
CHANGED
@@ -13,7 +13,7 @@ module Lucid
|
|
13
13
|
|
14
14
|
attr_reader :feature_tags
|
15
15
|
attr_accessor :feature
|
16
|
-
attr_reader :comment, :tags, :keyword
|
16
|
+
attr_reader :comment, :tags, :keyword, :background
|
17
17
|
|
18
18
|
def initialize(language, location, background, comment, tags, feature_tags, keyword, title, description, raw_steps)
|
19
19
|
@language, @location, @background, @comment, @tags, @feature_tags, @keyword, @title, @description, @raw_steps = language, location, background, comment, tags, feature_tags, keyword, title, description, raw_steps
|
@@ -22,34 +22,40 @@ module Lucid
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def accept(visitor)
|
25
|
-
|
26
|
-
|
25
|
+
background.accept(visitor)
|
27
26
|
visitor.visit_feature_element(self) do
|
28
27
|
comment.accept(visitor)
|
29
28
|
tags.accept(visitor)
|
30
29
|
visitor.visit_scenario_name(keyword, name, file_colon_line, source_indent(first_line_length))
|
31
30
|
|
32
|
-
skip_invoke! if
|
31
|
+
skip_invoke! if background.failed?
|
33
32
|
with_visitor(visitor) do
|
34
|
-
visitor.
|
33
|
+
execute(visitor.runtime, visitor)
|
35
34
|
end
|
36
35
|
|
37
36
|
@executed = true
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
40
|
+
def execute(runtime, visitor)
|
41
|
+
runtime.with_hooks(self, skip_hooks?) do
|
42
|
+
step_invocations.accept(visitor)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
41
46
|
def to_units(background)
|
42
|
-
[Unit.new(
|
47
|
+
[Unit.new(step_invocations)]
|
43
48
|
end
|
44
49
|
|
45
50
|
# Returns true if one or more steps failed.
|
46
51
|
def failed?
|
47
|
-
|
52
|
+
step_invocations.failed? || !!@exception
|
48
53
|
end
|
49
54
|
|
50
55
|
def fail!(exception)
|
51
56
|
@exception = exception
|
52
57
|
@current_visitor.visit_exception(@exception, :failed)
|
58
|
+
skip_invoke!
|
53
59
|
end
|
54
60
|
|
55
61
|
# Returns true if all steps passed.
|
@@ -59,13 +65,13 @@ module Lucid
|
|
59
65
|
|
60
66
|
# Returns the first exception (if any).
|
61
67
|
def exception
|
62
|
-
@exception ||
|
68
|
+
@exception || step_invocations.exception
|
63
69
|
end
|
64
70
|
|
65
71
|
# Returns the status.
|
66
72
|
def status
|
67
73
|
return :failed if @exception
|
68
|
-
|
74
|
+
step_invocations.status
|
69
75
|
end
|
70
76
|
|
71
77
|
def to_sexp
|
@@ -74,7 +80,7 @@ module Lucid
|
|
74
80
|
sexp += [comment] if comment
|
75
81
|
tags = @tags.to_sexp
|
76
82
|
sexp += tags if tags.any?
|
77
|
-
sexp +=
|
83
|
+
sexp += step_invocations.to_sexp if step_invocations.any?
|
78
84
|
sexp
|
79
85
|
end
|
80
86
|
|
@@ -85,17 +91,21 @@ module Lucid
|
|
85
91
|
end
|
86
92
|
|
87
93
|
def skip_invoke!
|
88
|
-
|
94
|
+
step_invocations.skip_invoke!
|
89
95
|
end
|
90
96
|
|
91
|
-
def
|
92
|
-
@
|
97
|
+
def step_invocations
|
98
|
+
@step_invocation ||= @background.create_step_invocations(my_step_invocations)
|
93
99
|
end
|
94
100
|
|
95
101
|
private
|
96
102
|
|
97
|
-
def
|
98
|
-
@raw_steps
|
103
|
+
def steps
|
104
|
+
StepCollection.new(@raw_steps)
|
105
|
+
end
|
106
|
+
|
107
|
+
def my_step_invocations
|
108
|
+
@raw_steps.map { |step| step.step_invocation }
|
99
109
|
end
|
100
110
|
|
101
111
|
def skip_hooks?
|
@@ -11,11 +11,10 @@ module Lucid
|
|
11
11
|
|
12
12
|
attr_accessor :feature
|
13
13
|
attr_reader :feature_tags
|
14
|
-
attr_reader :comment, :tags, :keyword
|
14
|
+
attr_reader :comment, :tags, :keyword, :background
|
15
15
|
|
16
16
|
module ExamplesArray #:nodoc:
|
17
17
|
def accept(visitor)
|
18
|
-
return if Lucid.wants_to_quit
|
19
18
|
return if self.empty?
|
20
19
|
|
21
20
|
visitor.visit_examples_array(self) do
|
@@ -34,7 +33,7 @@ module Lucid
|
|
34
33
|
end
|
35
34
|
|
36
35
|
def accept(visitor)
|
37
|
-
|
36
|
+
background.accept(visitor)
|
38
37
|
raise_missing_examples_error unless @example_sections
|
39
38
|
|
40
39
|
visitor.visit_feature_element(self) do
|
@@ -70,7 +69,7 @@ module Lucid
|
|
70
69
|
|
71
70
|
def step_invocations(cells)
|
72
71
|
step_invocations = steps.step_invocations_from_cells(cells)
|
73
|
-
@background.
|
72
|
+
@background.create_step_invocations(step_invocations)
|
74
73
|
end
|
75
74
|
|
76
75
|
def each_example_row(&proc)
|
data/lib/lucid/ast/specs.rb
CHANGED
data/lib/lucid/ast/step.rb
CHANGED
@@ -9,59 +9,30 @@ module Lucid
|
|
9
9
|
@steps.each{|step| step.step_collection = self}
|
10
10
|
end
|
11
11
|
|
12
|
-
def inspect
|
13
|
-
@steps.map { |s| [s.class, s.object_id] }.join(', ')
|
14
|
-
end
|
15
|
-
|
16
12
|
def accept(visitor)
|
17
|
-
return if Lucid.wants_to_quit
|
18
|
-
|
19
13
|
visitor.visit_steps(self) do
|
20
14
|
@steps.each do |step|
|
21
|
-
#visitor.visit_step(step)
|
22
15
|
step.accept(visitor)
|
23
16
|
end
|
24
17
|
end
|
25
18
|
end
|
26
19
|
|
27
20
|
def step_invocations(background = false)
|
28
|
-
|
21
|
+
StepInvocations.new(@steps.map{ |step|
|
29
22
|
i = step.step_invocation
|
30
23
|
i.background = background
|
31
24
|
i
|
32
25
|
})
|
33
26
|
end
|
34
27
|
|
35
|
-
def skip_invoke!
|
36
|
-
@steps.each{|step_invocation| step_invocation.skip_invoke!}
|
37
|
-
end
|
38
|
-
|
39
28
|
def step_invocations_from_cells(cells)
|
40
29
|
@steps.map{|step| step.step_invocation_from_cells(cells)}
|
41
30
|
end
|
42
31
|
|
43
|
-
def +(step_invocations)
|
44
|
-
dup(step_invocations)
|
45
|
-
end
|
46
|
-
|
47
|
-
# Duplicates this instance and adds +step_invocations+ to the end
|
48
|
-
def dup(step_invocations = [])
|
49
|
-
StepCollection.new(@steps + step_invocations)
|
50
|
-
end
|
51
|
-
|
52
32
|
def each(&proc)
|
53
33
|
@steps.each(&proc)
|
54
34
|
end
|
55
35
|
|
56
|
-
def previous_step(step)
|
57
|
-
i = @steps.index(step) || -1
|
58
|
-
@steps[i-1]
|
59
|
-
end
|
60
|
-
|
61
|
-
def empty?
|
62
|
-
@steps.empty?
|
63
|
-
end
|
64
|
-
|
65
36
|
def max_line_length(feature_element)
|
66
37
|
lengths = (@steps + [feature_element]).map{|e| e.text_length}
|
67
38
|
lengths.max
|
@@ -0,0 +1,73 @@
|
|
1
|
+
module Lucid
|
2
|
+
module AST
|
3
|
+
class StepInvocations
|
4
|
+
include Enumerable
|
5
|
+
|
6
|
+
def initialize(steps)
|
7
|
+
@steps = steps
|
8
|
+
@steps.each do |step|
|
9
|
+
step.step_collection = self
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def accept(visitor)
|
14
|
+
visitor.visit_steps(self) do
|
15
|
+
@steps.each do |step|
|
16
|
+
step.accept(visitor)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def each(&proc)
|
22
|
+
@steps.each(&proc)
|
23
|
+
end
|
24
|
+
|
25
|
+
def max_line_length(feature_element)
|
26
|
+
lengths = (@steps + [feature_element]).map{|e| e.text_length}
|
27
|
+
lengths.max
|
28
|
+
end
|
29
|
+
|
30
|
+
def skip_invoke!
|
31
|
+
@steps.each{ |step_invocation| step_invocation.skip_invoke! }
|
32
|
+
end
|
33
|
+
|
34
|
+
def +(step_invocations)
|
35
|
+
dup(step_invocations)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Duplicates this instance and adds +step_invocations+ to the end
|
39
|
+
def dup(step_invocations = [])
|
40
|
+
StepInvocations.new(@steps + step_invocations)
|
41
|
+
end
|
42
|
+
|
43
|
+
def exception
|
44
|
+
@exception ||= ((failed = @steps.detect {|step| step.exception}) && failed.exception)
|
45
|
+
end
|
46
|
+
|
47
|
+
def status
|
48
|
+
@steps.each do |step_invocation|
|
49
|
+
return step_invocation.status if step_invocation.status != :passed
|
50
|
+
end
|
51
|
+
:passed
|
52
|
+
end
|
53
|
+
|
54
|
+
def failed?
|
55
|
+
status == :failed
|
56
|
+
end
|
57
|
+
|
58
|
+
def previous_step(step)
|
59
|
+
i = @steps.index(step) || -1
|
60
|
+
@steps[i-1]
|
61
|
+
end
|
62
|
+
|
63
|
+
def length
|
64
|
+
@steps.length
|
65
|
+
end
|
66
|
+
|
67
|
+
def to_sexp
|
68
|
+
@steps.map{|step| step.to_sexp}
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/lib/lucid/ast/table.rb
CHANGED
@@ -177,7 +177,6 @@ module Lucid
|
|
177
177
|
end
|
178
178
|
|
179
179
|
def accept(visitor) #:nodoc:
|
180
|
-
return if Lucid.wants_to_quit
|
181
180
|
cells_rows.each do |row|
|
182
181
|
row.accept(visitor)
|
183
182
|
end
|
@@ -630,7 +629,6 @@ module Lucid
|
|
630
629
|
end
|
631
630
|
|
632
631
|
def accept(visitor)
|
633
|
-
return if Lucid.wants_to_quit
|
634
632
|
visitor.visit_table_row(self) do
|
635
633
|
each do |cell|
|
636
634
|
cell.accept(visitor)
|
@@ -688,8 +686,6 @@ module Lucid
|
|
688
686
|
end
|
689
687
|
|
690
688
|
def accept(visitor)
|
691
|
-
return if Lucid.wants_to_quit
|
692
|
-
|
693
689
|
visitor.visit_table_cell(self) do
|
694
690
|
visitor.visit_table_cell_value(value, status)
|
695
691
|
end
|
data/lib/lucid/ast/tags.rb
CHANGED
data/lib/lucid/ast/tdl_walker.rb
CHANGED
@@ -8,13 +8,6 @@ module Lucid
|
|
8
8
|
@runtime, @listeners, @configuration = runtime, listeners, configuration
|
9
9
|
end
|
10
10
|
|
11
|
-
def execute(scenario, skip_hooks)
|
12
|
-
runtime.with_hooks(scenario, skip_hooks) do
|
13
|
-
scenario.skip_invoke! if scenario.failed?
|
14
|
-
scenario.steps.accept(self)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
11
|
# This is being used to forward on messages from the AST to
|
19
12
|
# the formatters. This is being done in lieu of the explicit
|
20
13
|
# forwarding that was previously done.
|
@@ -37,6 +30,7 @@ module Lucid
|
|
37
30
|
end
|
38
31
|
|
39
32
|
def broadcast_message(message, *args, &block)
|
33
|
+
return self if Lucid.wants_to_quit
|
40
34
|
message = message.to_s.gsub('visit_', '')
|
41
35
|
if block_given?
|
42
36
|
send_to_all("before_#{message}", *args)
|
@@ -5,7 +5,7 @@ module Symbiont
|
|
5
5
|
|
6
6
|
def self.start
|
7
7
|
unless @@browser
|
8
|
-
target = ENV['BROWSER']
|
8
|
+
target = ENV['BROWSER'] || 'firefox'
|
9
9
|
@@browser = watir_browser(target)
|
10
10
|
end
|
11
11
|
@@browser
|
@@ -13,6 +13,7 @@ module Symbiont
|
|
13
13
|
|
14
14
|
def self.stop
|
15
15
|
@@browser.quit if @@browser
|
16
|
+
@@browser = false
|
16
17
|
end
|
17
18
|
|
18
19
|
private
|
@@ -2,5 +2,5 @@
|
|
2
2
|
<% std_opts = "-r common -r pages -r steps" %>
|
3
3
|
<% rpt_opts = "--format html --out output/specs-report.html" %>
|
4
4
|
|
5
|
-
default: <%= std_opts %>
|
6
|
-
report: <%= std_opts %> <%= rpt_opts %>
|
5
|
+
default: <%= browser %> <%= std_opts %>
|
6
|
+
report: <%= browser %> <%= std_opts %> <%= rpt_opts %>
|
data/lib/lucid/platform.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rbconfig'
|
|
2
2
|
|
3
3
|
module Lucid
|
4
4
|
unless defined?(Lucid::VERSION)
|
5
|
-
VERSION = '0.0
|
5
|
+
VERSION = '0.1.0'
|
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)
|
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
|
4
|
+
version: 0.1.0
|
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-
|
12
|
+
date: 2013-06-02 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_invocations.rb
|
174
175
|
- lib/lucid/ast/step_result.rb
|
175
176
|
- lib/lucid/ast/table.rb
|
176
177
|
- lib/lucid/ast/tags.rb
|
@@ -260,7 +261,7 @@ homepage: https://github.com/jnyman/lucid
|
|
260
261
|
licenses:
|
261
262
|
- MIT
|
262
263
|
post_install_message: ! "\n(::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)
|
263
|
-
(::)\n\n Thanks for installing Lucid 0.0
|
264
|
+
(::)\n\n Thanks for installing Lucid 0.1.0.\n\n(::) (::) (::) (::) (::) (::) (::)
|
264
265
|
(::) (::) (::) (::) (::)\n "
|
265
266
|
rdoc_options:
|
266
267
|
- --charset=UTF-8
|
@@ -283,6 +284,6 @@ rubyforge_project:
|
|
283
284
|
rubygems_version: 1.8.24
|
284
285
|
signing_key:
|
285
286
|
specification_version: 3
|
286
|
-
summary: lucid-0.0
|
287
|
+
summary: lucid-0.1.0
|
287
288
|
test_files: []
|
288
289
|
has_rdoc:
|