lucid 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +30 -10
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +15 -0
- data/Gemfile +4 -2
- data/HISTORY.md +22 -0
- data/{LICENSE.txt → LICENSE} +6 -3
- data/README.md +22 -8
- data/Rakefile +2 -1
- data/bin/lucid +10 -10
- data/bin/lucid-gen +4 -0
- data/lib/autotest/discover.rb +11 -0
- data/lib/autotest/lucid.rb +6 -0
- data/lib/autotest/lucid_mixin.rb +135 -0
- data/lib/autotest/lucid_rails.rb +6 -0
- data/lib/autotest/lucid_rails_rspec.rb +6 -0
- data/lib/autotest/lucid_rails_rspec2.rb +6 -0
- data/lib/autotest/lucid_rspec.rb +6 -0
- data/lib/autotest/lucid_rspec2.rb +6 -0
- data/lib/lucid.rb +32 -1
- data/lib/lucid/ast.rb +20 -0
- data/lib/lucid/ast/background.rb +116 -0
- data/lib/lucid/ast/comment.rb +24 -0
- data/lib/lucid/ast/doc_string.rb +44 -0
- data/lib/lucid/ast/empty_background.rb +33 -0
- data/lib/lucid/ast/examples.rb +49 -0
- data/lib/lucid/ast/feature.rb +99 -0
- data/lib/lucid/ast/has_steps.rb +74 -0
- data/lib/lucid/ast/location.rb +41 -0
- data/lib/lucid/ast/multiline_argument.rb +31 -0
- data/lib/lucid/ast/names.rb +13 -0
- data/lib/lucid/ast/outline_table.rb +194 -0
- data/lib/lucid/ast/scenario.rb +103 -0
- data/lib/lucid/ast/scenario_outline.rb +144 -0
- data/lib/lucid/ast/specs.rb +38 -0
- data/lib/lucid/ast/step.rb +122 -0
- data/lib/lucid/ast/step_collection.rb +92 -0
- data/lib/lucid/ast/step_invocation.rb +196 -0
- data/lib/lucid/ast/table.rb +730 -0
- data/lib/lucid/ast/tags.rb +28 -0
- data/lib/lucid/ast/tdl_walker.rb +195 -0
- data/lib/lucid/cli/app.rb +78 -0
- data/lib/lucid/cli/configuration.rb +261 -0
- data/lib/lucid/cli/options.rb +463 -0
- data/lib/lucid/cli/profile.rb +101 -0
- data/lib/lucid/configuration.rb +53 -0
- data/lib/lucid/core_ext/disable_autorunners.rb +15 -0
- data/lib/lucid/core_ext/instance_exec.rb +70 -0
- data/lib/lucid/core_ext/proc.rb +36 -0
- data/lib/lucid/core_ext/string.rb +9 -0
- data/lib/lucid/errors.rb +40 -0
- data/lib/lucid/factory.rb +43 -0
- data/lib/lucid/formatter/ansicolor.rb +168 -0
- data/lib/lucid/formatter/console.rb +218 -0
- data/lib/lucid/formatter/debug.rb +33 -0
- data/lib/lucid/formatter/duration.rb +11 -0
- data/lib/lucid/formatter/gherkin_formatter_adapter.rb +94 -0
- data/lib/lucid/formatter/gpretty.rb +24 -0
- data/lib/lucid/formatter/html.rb +610 -0
- data/lib/lucid/formatter/interceptor.rb +66 -0
- data/lib/lucid/formatter/io.rb +31 -0
- data/lib/lucid/formatter/jquery-min.js +154 -0
- data/lib/lucid/formatter/json.rb +19 -0
- data/lib/lucid/formatter/json_pretty.rb +10 -0
- data/lib/lucid/formatter/junit.rb +177 -0
- data/lib/lucid/formatter/lucid.css +283 -0
- data/lib/lucid/formatter/lucid.sass +244 -0
- data/lib/lucid/formatter/ordered_xml_markup.rb +24 -0
- data/lib/lucid/formatter/progress.rb +95 -0
- data/lib/lucid/formatter/rerun.rb +91 -0
- data/lib/lucid/formatter/standard.rb +235 -0
- data/lib/lucid/formatter/stepdefs.rb +14 -0
- data/lib/lucid/formatter/steps.rb +49 -0
- data/lib/lucid/formatter/summary.rb +35 -0
- data/lib/lucid/formatter/unicode.rb +53 -0
- data/lib/lucid/formatter/usage.rb +132 -0
- data/lib/lucid/generator.rb +21 -0
- data/lib/lucid/generators/project.rb +70 -0
- data/lib/lucid/generators/project/Gemfile.tt +6 -0
- data/lib/lucid/generators/project/browser-symbiont.rb +24 -0
- data/lib/lucid/generators/project/driver-symbiont.rb +4 -0
- data/lib/lucid/generators/project/errors.rb +26 -0
- data/lib/lucid/generators/project/events-symbiont.rb +36 -0
- data/lib/lucid/generators/project/lucid-symbiont.yml +6 -0
- data/lib/lucid/interface.rb +8 -0
- data/lib/lucid/interface_methods.rb +125 -0
- data/lib/lucid/interface_rb/matcher.rb +108 -0
- data/lib/lucid/interface_rb/rb_hook.rb +18 -0
- data/lib/lucid/interface_rb/rb_language.rb +190 -0
- data/lib/lucid/interface_rb/rb_lucid.rb +119 -0
- data/lib/lucid/interface_rb/rb_step_definition.rb +122 -0
- data/lib/lucid/interface_rb/rb_transform.rb +57 -0
- data/lib/lucid/interface_rb/rb_world.rb +136 -0
- data/lib/lucid/interface_rb/regexp_argument_matcher.rb +21 -0
- data/lib/lucid/load_path.rb +13 -0
- data/lib/lucid/parser.rb +2 -126
- data/lib/lucid/platform.rb +27 -0
- data/lib/lucid/rspec/allow_doubles.rb +20 -0
- data/lib/lucid/rspec/disallow_options.rb +27 -0
- data/lib/lucid/runtime.rb +200 -0
- data/lib/lucid/runtime/facade.rb +60 -0
- data/lib/lucid/runtime/interface_io.rb +60 -0
- data/lib/lucid/runtime/orchestrator.rb +218 -0
- data/lib/lucid/runtime/results.rb +64 -0
- data/lib/lucid/runtime/specs_loader.rb +79 -0
- data/lib/lucid/spec_file.rb +112 -0
- data/lib/lucid/step_definition_light.rb +20 -0
- data/lib/lucid/step_definitions.rb +13 -0
- data/lib/lucid/step_match.rb +99 -0
- data/lib/lucid/tdl_builder.rb +282 -0
- data/lib/lucid/term/ansicolor.rb +118 -0
- data/lib/lucid/unit.rb +11 -0
- data/lib/lucid/wire_support/configuration.rb +38 -0
- data/lib/lucid/wire_support/connection.rb +61 -0
- data/lib/lucid/wire_support/request_handler.rb +32 -0
- data/lib/lucid/wire_support/wire_exception.rb +32 -0
- data/lib/lucid/wire_support/wire_language.rb +54 -0
- data/lib/lucid/wire_support/wire_packet.rb +34 -0
- data/lib/lucid/wire_support/wire_protocol.rb +43 -0
- data/lib/lucid/wire_support/wire_protocol/requests.rb +125 -0
- data/lib/lucid/wire_support/wire_step_definition.rb +26 -0
- data/lucid.gemspec +25 -14
- metadata +220 -12
- data/lib/lucid/app.rb +0 -103
- data/lib/lucid/options.rb +0 -168
- data/lib/lucid/version.rb +0 -3
- data/lucid.yml +0 -8
data/lib/lucid/ast.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'lucid/ast/comment'
|
2
|
+
require 'lucid/ast/specs'
|
3
|
+
require 'lucid/ast/feature'
|
4
|
+
require 'lucid/ast/background'
|
5
|
+
require 'lucid/ast/scenario'
|
6
|
+
require 'lucid/ast/scenario_outline'
|
7
|
+
require 'lucid/ast/step_invocation'
|
8
|
+
require 'lucid/ast/step_collection'
|
9
|
+
require 'lucid/ast/step'
|
10
|
+
require 'lucid/ast/table'
|
11
|
+
require 'lucid/ast/tags'
|
12
|
+
require 'lucid/ast/doc_string'
|
13
|
+
require 'lucid/ast/outline_table'
|
14
|
+
require 'lucid/ast/examples'
|
15
|
+
require 'lucid/ast/tdl_walker'
|
16
|
+
|
17
|
+
module Lucid
|
18
|
+
module AST
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'lucid/ast/has_steps'
|
2
|
+
require 'lucid/ast/names'
|
3
|
+
require 'lucid/ast/location'
|
4
|
+
|
5
|
+
module Lucid
|
6
|
+
module AST
|
7
|
+
class Background #:nodoc:
|
8
|
+
include HasSteps
|
9
|
+
include Names
|
10
|
+
include HasLocation
|
11
|
+
attr_accessor :feature
|
12
|
+
|
13
|
+
def initialize(language, location, comment, keyword, title, description, raw_steps)
|
14
|
+
@language, @location, @comment, @keyword, @title, @description, @raw_steps = language, location, comment, keyword, title, description, raw_steps
|
15
|
+
@failed = nil
|
16
|
+
@first_collection_created = false
|
17
|
+
attach_steps(@raw_steps)
|
18
|
+
end
|
19
|
+
|
20
|
+
def feature_elements
|
21
|
+
feature.feature_elements
|
22
|
+
end
|
23
|
+
|
24
|
+
def step_invocations
|
25
|
+
@step_invocations ||= steps.step_invocations(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
def step_collection(scenario_step_invocations)
|
29
|
+
if(@first_collection_created)
|
30
|
+
steps.step_invocations(true).dup(scenario_step_invocations)
|
31
|
+
else
|
32
|
+
@first_collection_created = true
|
33
|
+
step_invocations.dup(scenario_step_invocations)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def accept(visitor)
|
38
|
+
return if Lucid.wants_to_quit
|
39
|
+
visitor.visit_comment(@comment) unless @comment.empty?
|
40
|
+
visitor.visit_background_name(@keyword, name, file_colon_line, source_indent(first_line_length))
|
41
|
+
with_visitor(hook_context, visitor) do
|
42
|
+
visitor.runtime.before(hook_context)
|
43
|
+
skip_invoke! if failed?
|
44
|
+
visitor.visit_steps(step_invocations)
|
45
|
+
@failed = step_invocations.any? { |step_invocation| step_invocation.exception || step_invocation.status != :passed }
|
46
|
+
visitor.runtime.after(hook_context) if @failed || feature_elements.empty?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def with_visitor(scenario, visitor)
|
51
|
+
@current_visitor = visitor
|
52
|
+
if self != scenario && scenario.respond_to?(:with_visitor)
|
53
|
+
scenario.with_visitor(visitor) do
|
54
|
+
yield
|
55
|
+
end
|
56
|
+
else
|
57
|
+
yield
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def accept_hook?(hook)
|
62
|
+
if hook_context != self
|
63
|
+
hook_context.accept_hook?(hook)
|
64
|
+
else
|
65
|
+
# We have no scenarios, just ask our feature
|
66
|
+
feature.accept_hook?(hook)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def skip_invoke!
|
71
|
+
step_invocations.each{|step_invocation| step_invocation.skip_invoke!}
|
72
|
+
end
|
73
|
+
|
74
|
+
def failed?
|
75
|
+
!!@failed
|
76
|
+
end
|
77
|
+
|
78
|
+
def hook_context
|
79
|
+
feature_elements.first || self
|
80
|
+
end
|
81
|
+
|
82
|
+
def to_sexp
|
83
|
+
sexp = [:background, line, @keyword]
|
84
|
+
sexp += [name] unless name.empty?
|
85
|
+
comment = @comment.to_sexp
|
86
|
+
sexp += [comment] if comment
|
87
|
+
sexp += steps.to_sexp if steps.any?
|
88
|
+
sexp
|
89
|
+
end
|
90
|
+
|
91
|
+
def fail!(exception)
|
92
|
+
@failed = true
|
93
|
+
@exception = exception
|
94
|
+
@current_visitor.visit_exception(@exception, :failed)
|
95
|
+
end
|
96
|
+
|
97
|
+
# Override this method, as there are situations where the background
|
98
|
+
# wind up being the one called fore Before scenarios, and
|
99
|
+
# backgrounds don't have tags.
|
100
|
+
def source_tags
|
101
|
+
[]
|
102
|
+
end
|
103
|
+
|
104
|
+
def source_tag_names
|
105
|
+
source_tags.map { |tag| tag.name }
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def steps
|
111
|
+
@steps ||= StepCollection.new(@raw_steps)
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Lucid
|
2
|
+
module AST
|
3
|
+
class Comment #:nodoc:
|
4
|
+
def initialize(value)
|
5
|
+
@value = value
|
6
|
+
end
|
7
|
+
|
8
|
+
def empty?
|
9
|
+
@value.nil? || @value == ""
|
10
|
+
end
|
11
|
+
|
12
|
+
def accept(visitor)
|
13
|
+
return if Lucid.wants_to_quit
|
14
|
+
@value.strip.split("\n").each do |line|
|
15
|
+
visitor.visit_comment_line(line.strip)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_sexp
|
20
|
+
(@value.nil? || @value == '') ? nil : [:comment, @value]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Lucid
|
2
|
+
module AST
|
3
|
+
class DocString < String #:nodoc:
|
4
|
+
attr_accessor :file
|
5
|
+
|
6
|
+
def self.default_arg_name
|
7
|
+
"string"
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_reader :content_type
|
11
|
+
|
12
|
+
def initialize(string, content_type)
|
13
|
+
@content_type = content_type
|
14
|
+
super string
|
15
|
+
end
|
16
|
+
|
17
|
+
def to_step_definition_arg
|
18
|
+
self
|
19
|
+
end
|
20
|
+
|
21
|
+
def accept(visitor)
|
22
|
+
return if Lucid.wants_to_quit
|
23
|
+
visitor.visit_doc_string(self)
|
24
|
+
end
|
25
|
+
|
26
|
+
def arguments_replaced(arguments) #:nodoc:
|
27
|
+
string = self
|
28
|
+
arguments.each do |name, value|
|
29
|
+
value ||= ''
|
30
|
+
string = string.gsub(name, value)
|
31
|
+
end
|
32
|
+
DocString.new(string, content_type)
|
33
|
+
end
|
34
|
+
|
35
|
+
def has_text?(text)
|
36
|
+
index(text)
|
37
|
+
end
|
38
|
+
|
39
|
+
def to_sexp #:nodoc:
|
40
|
+
[:doc_string, to_step_definition_arg]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'lucid/ast/step_collection'
|
2
|
+
|
3
|
+
module Lucid
|
4
|
+
module AST
|
5
|
+
class EmptyBackground
|
6
|
+
attr_writer :file
|
7
|
+
attr_accessor :feature
|
8
|
+
|
9
|
+
def failed?
|
10
|
+
false
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_elements
|
14
|
+
[]
|
15
|
+
end
|
16
|
+
|
17
|
+
def step_collection(step_invocations)
|
18
|
+
StepCollection.new(step_invocations)
|
19
|
+
end
|
20
|
+
|
21
|
+
def step_invocations
|
22
|
+
[]
|
23
|
+
end
|
24
|
+
|
25
|
+
def init
|
26
|
+
end
|
27
|
+
|
28
|
+
def accept(visitor)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'lucid/ast/names'
|
2
|
+
|
3
|
+
module Lucid
|
4
|
+
module AST
|
5
|
+
class Examples #:nodoc:
|
6
|
+
include Names
|
7
|
+
include HasLocation
|
8
|
+
attr_writer :outline_table
|
9
|
+
|
10
|
+
def initialize(location, comment, keyword, title, description, outline_table)
|
11
|
+
@location, @comment, @keyword, @title, @description, @outline_table = location, comment, keyword, title, description, outline_table
|
12
|
+
raise ArgumentError unless @location.is_a?(Location)
|
13
|
+
raise ArgumentError unless @comment.is_a?(Comment)
|
14
|
+
end
|
15
|
+
|
16
|
+
attr_reader :gherkin_statement
|
17
|
+
def gherkin_statement(statement=nil)
|
18
|
+
@gherkin_statement ||= statement
|
19
|
+
end
|
20
|
+
|
21
|
+
def accept(visitor)
|
22
|
+
return if Lucid.wants_to_quit
|
23
|
+
visitor.visit_comment(@comment) unless @comment.empty?
|
24
|
+
visitor.visit_examples_name(@keyword, name)
|
25
|
+
visitor.visit_outline_table(@outline_table)
|
26
|
+
end
|
27
|
+
|
28
|
+
def skip_invoke!
|
29
|
+
@outline_table.skip_invoke!
|
30
|
+
end
|
31
|
+
|
32
|
+
def each_example_row(&proc)
|
33
|
+
@outline_table.cells_rows[1..-1].each(&proc)
|
34
|
+
end
|
35
|
+
|
36
|
+
def failed?
|
37
|
+
@outline_table.cells_rows[1..-1].select{|row| row.failed?}.any?
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_sexp
|
41
|
+
sexp = [:examples, @keyword, name]
|
42
|
+
comment = @comment.to_sexp
|
43
|
+
sexp += [comment] if comment
|
44
|
+
sexp += [@outline_table.to_sexp]
|
45
|
+
sexp
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'lucid/ast/names'
|
2
|
+
require 'lucid/ast/location'
|
3
|
+
require 'lucid/ast/location'
|
4
|
+
|
5
|
+
module Lucid
|
6
|
+
module AST
|
7
|
+
|
8
|
+
class Feature #:nodoc:
|
9
|
+
include Names
|
10
|
+
include HasLocation
|
11
|
+
|
12
|
+
attr_accessor :language
|
13
|
+
attr_reader :feature_elements
|
14
|
+
|
15
|
+
def initialize(location, background, comment, tags, keyword, title, description, feature_elements)
|
16
|
+
@background, @comment, @tags, @keyword, @title, @description, @feature_elements = background, comment, tags, keyword, title, description, feature_elements
|
17
|
+
@background.feature = self
|
18
|
+
@location = location
|
19
|
+
@feature_elements.each { |e| e.feature = self }
|
20
|
+
end
|
21
|
+
|
22
|
+
attr_reader :gherkin_statement
|
23
|
+
def gherkin_statement(statement=nil)
|
24
|
+
@gherkin_statement ||= statement
|
25
|
+
end
|
26
|
+
|
27
|
+
def step_count
|
28
|
+
units.inject(0) { |total, unit| total += unit.step_count }
|
29
|
+
end
|
30
|
+
|
31
|
+
def accept(visitor)
|
32
|
+
return if Lucid.wants_to_quit
|
33
|
+
visitor.visit_comment(@comment) unless @comment.empty?
|
34
|
+
visitor.visit_tags(@tags)
|
35
|
+
visitor.visit_feature_name(@keyword, indented_name)
|
36
|
+
visitor.visit_background(@background) if !@background.is_a?(EmptyBackground)
|
37
|
+
@feature_elements.each do |feature_element|
|
38
|
+
visitor.visit_feature_element(feature_element)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def indented_name
|
43
|
+
indent = ""
|
44
|
+
name.split("\n").map do |l|
|
45
|
+
s = "#{indent}#{l}"
|
46
|
+
indent = " "
|
47
|
+
s
|
48
|
+
end.join("\n")
|
49
|
+
end
|
50
|
+
|
51
|
+
def source_tags
|
52
|
+
@tags.tags
|
53
|
+
end
|
54
|
+
|
55
|
+
def source_tag_names
|
56
|
+
source_tags.map { |tag| tag.name }
|
57
|
+
end
|
58
|
+
|
59
|
+
def accept_hook?(hook)
|
60
|
+
@tags.accept_hook?(hook)
|
61
|
+
end
|
62
|
+
|
63
|
+
def backtrace_line(step_name, line)
|
64
|
+
"#{location.on_line(line)}:in `#{step_name}'"
|
65
|
+
end
|
66
|
+
|
67
|
+
def short_name
|
68
|
+
first_line = name.split(/\n/)[0]
|
69
|
+
if first_line =~ /#{language.keywords('feature')}:(.*)/
|
70
|
+
$1.strip
|
71
|
+
else
|
72
|
+
first_line
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def to_sexp
|
77
|
+
sexp = [:feature, file, name]
|
78
|
+
comment = @comment.to_sexp
|
79
|
+
sexp += [comment] if comment
|
80
|
+
tags = @tags.to_sexp
|
81
|
+
sexp += tags if tags.any?
|
82
|
+
sexp += [@background.to_sexp] if @background
|
83
|
+
sexp += @feature_elements.map{|fe| fe.to_sexp}
|
84
|
+
sexp
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
attr_reader :background
|
90
|
+
|
91
|
+
def units
|
92
|
+
@units ||= @feature_elements.map do |element|
|
93
|
+
element.to_units(background)
|
94
|
+
end.flatten
|
95
|
+
end
|
96
|
+
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'enumerator'
|
2
|
+
require 'gherkin/tag_expression'
|
3
|
+
|
4
|
+
module Lucid
|
5
|
+
module AST
|
6
|
+
module HasSteps #:nodoc:
|
7
|
+
attr_reader :gherkin_statement, :raw_steps, :title, :description
|
8
|
+
def gherkin_statement(statement=nil)
|
9
|
+
@gherkin_statement ||= statement
|
10
|
+
end
|
11
|
+
|
12
|
+
def attach_steps(steps)
|
13
|
+
steps.each do |step|
|
14
|
+
step.feature_element = self
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def first_line_length
|
19
|
+
name_line_lengths[0]
|
20
|
+
end
|
21
|
+
|
22
|
+
def text_length
|
23
|
+
name_line_lengths.max
|
24
|
+
end
|
25
|
+
|
26
|
+
def name_line_lengths
|
27
|
+
if name.strip.empty?
|
28
|
+
[AST::Step::INDENT + @keyword.unpack('U*').length + ': '.length]
|
29
|
+
else
|
30
|
+
name.split("\n").enum_for(:each_with_index).map do |line, line_number|
|
31
|
+
if line_number == 0
|
32
|
+
AST::Step::INDENT + @keyword.unpack('U*').length + ': '.length + line.unpack('U*').length
|
33
|
+
else
|
34
|
+
AST::Step::INDENT + AST::Step::INDENT + line.unpack('U*').length
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def matches_scenario_names?(scenario_name_regexps)
|
41
|
+
scenario_name_regexps.detect{|n| n =~ name}
|
42
|
+
end
|
43
|
+
|
44
|
+
def backtrace_line(step_name = "#{@keyword}: #{name}", line = self.line)
|
45
|
+
"#{location.on_line(line)}:in `#{step_name}'"
|
46
|
+
end
|
47
|
+
|
48
|
+
def source_indent(text_length)
|
49
|
+
max_line_length - text_length
|
50
|
+
end
|
51
|
+
|
52
|
+
def max_line_length
|
53
|
+
steps.max_line_length(self)
|
54
|
+
end
|
55
|
+
|
56
|
+
def accept_hook?(hook)
|
57
|
+
Gherkin::TagExpression.new(hook.tag_expressions).evaluate(source_tags)
|
58
|
+
end
|
59
|
+
|
60
|
+
def source_tag_names
|
61
|
+
source_tags.map { |tag| tag.name }
|
62
|
+
end
|
63
|
+
|
64
|
+
def source_tags
|
65
|
+
@tags.tags.to_a + feature_tags.tags.to_a
|
66
|
+
end
|
67
|
+
|
68
|
+
def language
|
69
|
+
@language || raise("Language is required for a #{self.class}")
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|