cucumber-tcl 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 84ec39aecfb982b06d4ba5ebb5700f0a40e97018
4
- data.tar.gz: 1833986ac0f590191f935850f7ebdaf94fe78e98
3
+ metadata.gz: 1dc75168d206c5d7e6728ec965e64415598c0abd
4
+ data.tar.gz: 19197873bc15570e4b896d86111f83c9b4a4f824
5
5
  SHA512:
6
- metadata.gz: 4eab85f4429224ff463a142913ca64999173889ecb0f5e1cfdbbb4d8e81ab6edadcbec561435d51cfca2b65ba1d17c6f9a30dc58af487e68d3cc6a97330de76f
7
- data.tar.gz: 8c9011e35f8a38800421482f9d3fcb97c92190a0281fa7835584414ac947491db54e2906f8cb041de22f8011f5ab7e69b41dac1f047cad5a138ed9ccd1f79987
6
+ metadata.gz: dc786ce2300ed122eea620a9de903d96bc28a801425320e0d398c5ed6f29348288cb61742c3e6339247ea2d92c020b9b6485e0ee1d4e97e8aa7cae8ff87ce1a0
7
+ data.tar.gz: 3e435def41a499c7c367cc4f6419a0111e0bb8932dfd5099794a2b1add1932f4322f46020d33f5dcdc66b380cf54c2ea67c7ea2b19ddcaa0b641bbd155c45ec1
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
1
  source "https://rubygems.org"
2
2
  gemspec
3
-
4
- # hack
5
- gem "cucumber", path: "../cucumber"
data/README.md CHANGED
@@ -1,12 +1,23 @@
1
- Cucumber TCL Bindings
2
- =====================
1
+ Build status: [![Circle CI](https://circleci.com/gh/cucumber/cucumber-ruby-tcl/tree/master.svg?style=svg)](https://circleci.com/gh/cucumber/cucumber-ruby-tcl/tree/master)
3
2
 
4
- Define Cucumber steps using TCL code.
3
+ Cucumber Tcl
4
+ ============
5
+
6
+ Drive your Tcl code with Cucumber.
7
+
8
+ Dependencies
9
+ ------------
10
+
11
+ You'll need the following:
12
+
13
+ * tcl8.5 and dev libraries
14
+ * ruby > 1.9.1 along with its dev libraries
15
+ * [Cucumber-Ruby](https://github.com/cucumber/cucumber)
5
16
 
6
17
  How to use
7
18
  ----------
8
19
 
9
- First, add the project to your Gemfile:
20
+ First, add the `cucumber-tcl` plugin to your Gemfile:
10
21
 
11
22
  gem 'cucumber-tcl'
12
23
 
@@ -18,14 +29,27 @@ In a file in Cucumber's load path, like `features/support/env.rb`, add the follo
18
29
 
19
30
  require 'cucumber/tcl'
20
31
 
21
- Finally, add a TCL entry point, at `features/support/env.tcl`.
32
+ You should now be able to start writing features, and implementing the step definitions in Tcl. These should be placed in `.tcl` files below the features directory. To create the step definitions, you're provided with `Given`, `When`, `Then` and `And` procs for you to call, for example:
22
33
 
23
- Your TCL program must implement two procs: `step_definition_exists` and `execute_step_definition`. For example:
34
+ Given {^I am a logged in user$} {
35
+ puts "I'm a logged in user
36
+ }
24
37
 
25
- proc step_definition_exists {step_name} {
26
- return 1
38
+ When {^I purchase a ticket$} {
39
+ puts "Purchase a ticket"
27
40
  }
28
41
 
29
- proc execute_step_definition {step_name} {
30
- puts "Hello world"
42
+ Then {^I receive confirmation of the purchase$} {
43
+ puts "Purchase confirmation"
31
44
  }
45
+
46
+ If your regular expression captures any matches, you should provide a list of variable names as the second parameter to any of these procedure calls. These will then be available to your script, for example:
47
+
48
+ Given {^I am logged in with username (\w+)$} {username} {
49
+ puts "Username is $username"
50
+ }
51
+
52
+ Given {^I buy (\d+) cucumbers for $(\d+)$} {quantity price} {
53
+ puts "$quantity cucumbers bought. Price was $price"
54
+ }
55
+
data/Rakefile CHANGED
@@ -3,8 +3,16 @@ require 'rubygems'
3
3
  require 'bundler'
4
4
  Bundler::GemHelper.install_tasks
5
5
 
6
- task default: [:cucumber]
6
+ task default: [:rspec, :cucumber, :tcltest]
7
+
8
+ task :rspec do
9
+ sh "rspec"
10
+ end
7
11
 
8
12
  task :cucumber do
9
13
  sh "cucumber -f pretty"
10
14
  end
15
+
16
+ task :tcltest do
17
+ sh "export TEST=1 && tclsh8.5 lib/cucumber/tcl/test/test_framework.tcl"
18
+ end
data/circle.yml ADDED
@@ -0,0 +1,10 @@
1
+ machine:
2
+ pre:
3
+ - sudo apt-get install tcl8.5-dev
4
+ environment:
5
+ C_INCLUDE_PATH: /usr/include/tcl8.5/
6
+
7
+ test:
8
+ override:
9
+ - bundle exec rake
10
+
data/cucumber-tcl.gemspec CHANGED
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.platform = Gem::Platform::RUBY
14
14
  s.required_ruby_version = ">= 1.9.3"
15
15
 
16
- s.add_dependency 'ruby-tcl'
17
- s.add_dependency 'cucumber-core'
16
+ s.add_dependency 'ruby-tcl', '~> 0.1.1'
17
+ s.add_dependency 'cucumber-core', '~> 1.1.0'
18
18
 
19
19
  s.add_development_dependency 'cucumber', '~> 2.0.0.rc.4'
20
20
  s.add_development_dependency 'rspec', '~> 3.2'
@@ -11,13 +11,9 @@ Feature: Define a step
11
11
  """
12
12
  require 'cucumber/tcl'
13
13
  """
14
- And a file named "features/support/env.tcl" with:
14
+ And a file named "features/step_defintions/steps.tcl" with:
15
15
  """
16
- proc step_definition_exists {step_name} {
17
- return 1
18
- }
19
-
20
- proc execute_step_definition {step_name} {
16
+ Given {^passing$} {
21
17
  puts "Hello world"
22
18
  }
23
19
  """
@@ -26,3 +22,27 @@ Feature: Define a step
26
22
  """
27
23
  Hello world
28
24
  """
25
+
26
+ Scenario: Define a step with a parameter
27
+ Given a file named "features/test.feature" with:
28
+ """
29
+ Feature:
30
+ Scenario:
31
+ Given passing 123
32
+ """
33
+ And a file named "features/support/env.rb" with:
34
+ """
35
+ require 'cucumber/tcl'
36
+ """
37
+ And a file named "features/step_defintions/steps.tcl" with:
38
+ """
39
+ Given {^passing (\d+)$} {num} {
40
+ puts "Hello $num"
41
+ }
42
+ """
43
+ When I run `cucumber`
44
+ Then it should pass with:
45
+ """
46
+ Hello 123
47
+ """
48
+
@@ -0,0 +1,27 @@
1
+ Feature: DocStrings
2
+
3
+ Scenario: Match a step with a DocString
4
+ Given a file named "features/test.feature" with:
5
+ """
6
+ Feature:
7
+ Scenario:
8
+ Given passing with a DocString:
9
+ \"\"\"
10
+ DocString content
11
+ \"\"\"
12
+ """
13
+ And a file named "features/support/env.rb" with:
14
+ """
15
+ require 'cucumber/tcl'
16
+ """
17
+ And a file named "features/step_defintions/steps.tcl" with:
18
+ """
19
+ Given {^passing with a DocString:$} {content} {
20
+ puts "Hello $content"
21
+ }
22
+ """
23
+ When I run `cucumber`
24
+ Then it should pass with:
25
+ """
26
+ Hello DocString content
27
+ """
@@ -0,0 +1,24 @@
1
+ require 'cucumber/core/filter'
2
+
3
+ module Cucumber
4
+ module Tcl
5
+
6
+ ActivateSteps = Cucumber::Core::Filter.new(:step_definitions) do
7
+ def test_case(test_case)
8
+ activated_steps = test_case.test_steps.map do |test_step|
9
+ attempt_to_activate(test_step)
10
+ end
11
+ test_case.with_steps(activated_steps).describe_to receiver
12
+ end
13
+
14
+ private
15
+
16
+ def attempt_to_activate(test_step)
17
+ return test_step unless step_definitions.match?(test_step)
18
+ test_step.with_action &step_definitions.action_for(test_step)
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+
@@ -0,0 +1,98 @@
1
+
2
+ # Set a variable to allow this to be more easily tested
3
+ if {[info exists env(TEST)] && $env(TEST) eq 1} {
4
+ set TEST 1
5
+ } else {
6
+ set TEST 0
7
+ }
8
+
9
+ #TODO make this a namespace to avoid globals
10
+ set STEPS [list]
11
+
12
+ #
13
+ # Define procs to match Gherkin keyworkds that put data in the STEPS array
14
+ #
15
+ proc Given args {
16
+ _add_step {*}$args
17
+ }
18
+
19
+ proc When args {
20
+ _add_step {*}$args
21
+ }
22
+
23
+ proc Then args {
24
+ _add_step {*}$args
25
+ }
26
+
27
+ proc And args {
28
+ _add_step {*}$args
29
+ }
30
+
31
+ proc _add_step args {
32
+
33
+ global STEPS
34
+
35
+ if {[llength $args] == 2} {
36
+ set re [lindex $args 0]
37
+ set params {}
38
+ set body [lindex $args 1]
39
+ } elseif {[llength $args] == 3} {
40
+ set re [lindex $args 0]
41
+ set params [lindex $args 1]
42
+ set body [lindex $args 2]
43
+ } else {
44
+ error "The parameters for this procedure are regular_expression ?list_of_capture_variables? body"
45
+ return 0
46
+ }
47
+
48
+ lappend STEPS [list $re $params $body]
49
+ }
50
+
51
+ #
52
+ # Procs needed by cucumber for checking and executing steps
53
+ proc step_definition_exists { step_name } {
54
+ set res [_search_steps $step_name 0]
55
+ return $res
56
+ }
57
+
58
+
59
+ proc execute_step_definition { step_name {multiline_args {}} } {
60
+ # TODO: handle parameters in the regexp
61
+ set res [_search_steps $step_name 1 $multiline_args]
62
+ return $res
63
+
64
+ }
65
+
66
+
67
+ proc _search_steps {step_name {execute 0} {multiline_args {}}} {
68
+ global STEPS
69
+
70
+ foreach step $STEPS {
71
+ set existing_step_name [lindex $step 0]
72
+ set existing_step_params [lindex $step 1]
73
+ set existing_step_body [lindex $step 2]
74
+
75
+ if {[regexp $existing_step_name $step_name matchresult {*}[join $existing_step_params]]} {
76
+
77
+ # Now we've found a match, handle multiline args. The name of the var
78
+ # should be the last value of the $existing_step_params.
79
+ if {$multiline_args ne {}} {
80
+ set multiline_var_name [lindex $existing_step_params end]
81
+ set $multiline_var_name $multiline_args
82
+ }
83
+
84
+ if {$execute == 1} {
85
+ eval $existing_step_body
86
+ }
87
+ return 1
88
+ }
89
+ }
90
+ return 0
91
+ }
92
+
93
+ if {$TEST ne 1} {
94
+ #TODO let that path be configurable from cucumber-ruby
95
+ foreach x [glob features/**/*.tcl] {
96
+ source $x
97
+ }
98
+ }
@@ -0,0 +1,40 @@
1
+ require 'tcl'
2
+
3
+ module Cucumber
4
+ module Tcl
5
+
6
+ class StepDefinitions
7
+ def initialize(path)
8
+ raise ArgumentError, "cucumber-tcl entry point #{path} does not exist." unless File.exists?(path)
9
+ @tcl = ::Tcl::Interp.load_from_file(path)
10
+ end
11
+
12
+ def match?(test_step)
13
+ step_name = test_step.name
14
+ @tcl.proc('step_definition_exists').call(step_name) == "1"
15
+ end
16
+
17
+ def action_for(test_step)
18
+ step_name = test_step.name
19
+ arguments = ArgumentList.new(step_name)
20
+ test_step.source.last.multiline_arg.describe_to(arguments)
21
+ proc { @tcl.proc('execute_step_definition').call(*arguments) }
22
+ end
23
+
24
+ class ArgumentList
25
+ def initialize(*args)
26
+ @arguments = args
27
+ end
28
+
29
+ def doc_string(arg)
30
+ @arguments << arg.content
31
+ end
32
+
33
+ def to_a
34
+ @arguments
35
+ end
36
+ end
37
+ end
38
+
39
+ end
40
+ end
@@ -0,0 +1,265 @@
1
+ package require tcltest 2
2
+ namespace import tcltest::*
3
+
4
+ source "./lib/cucumber/tcl/framework.tcl"
5
+
6
+ #
7
+ # Test Given
8
+ #
9
+ test Given-1 {calling Given with 2 parameters adds a new entry to the STEPS list with an empty parameters list} {
10
+ -setup {
11
+ set ::STEPS [list]
12
+ }
13
+ -body {
14
+ Given {^Regular Expression$} { puts "Given RegExp" }
15
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
16
+ }
17
+ -result 1
18
+ }
19
+
20
+ test Given-2 {calling Given twice adds 2 entries to the STEPS list} {
21
+ -setup {
22
+ set ::STEPS [list]
23
+ }
24
+ -body {
25
+ Given {^Regular Expression$} { puts "Given RegExp" }
26
+ Given {^Regular Expression 2$} { puts "Given RegExp 2" }
27
+ expr { [llength $::STEPS] == 2 && [llength [lindex $::STEPS 0]] == 3}
28
+ }
29
+ -result 1
30
+ }
31
+
32
+ test Given-3 {calling Given with 3 parameters adds a new entry to the STEPS list} {
33
+ -setup {
34
+ set ::STEPS [list]
35
+ }
36
+ -body {
37
+ Given {^Regular Expression (\d+)$} {match} { puts "Given RegExp $match" }
38
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
39
+ }
40
+ -result 1
41
+ }
42
+
43
+ #
44
+ # Test _add_step
45
+ #
46
+ test _add_step-1 {calling _add_step with 2 parameters adds a new entry to the STEPS list with an empty parameters list} {
47
+ -setup {
48
+ set ::STEPS [list]
49
+ }
50
+ -body {
51
+ _add_step {^Regular Expression$} { puts "Given RegExp" }
52
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
53
+ }
54
+ -result 1
55
+ }
56
+
57
+ test _add_step-2 {calling _add_step twice adds 2 entries to the STEPS list} {
58
+ -setup {
59
+ set ::STEPS [list]
60
+ }
61
+ -body {
62
+ _add_step {^Regular Expression$} { puts "Given RegExp" }
63
+ _add_step {^Regular Expression 2$} { puts "Given RegExp 2" }
64
+ expr { [llength $::STEPS] == 2 && [llength [lindex $::STEPS 0]] == 3}
65
+ }
66
+ -result 1
67
+ }
68
+
69
+ test _add_step-3 {calling _add_step with 3 parameters adds a new entry to the STEPS list} {
70
+ -setup {
71
+ set ::STEPS [list]
72
+ }
73
+ -body {
74
+ _add_step {^Regular Expression (\d+)$} {match} { puts "Given RegExp $match" }
75
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
76
+ }
77
+ -result 1
78
+ }
79
+
80
+ test _add_step-4 {calling _add_step with more than 3 parameters adds a new entry to the STEPS list} {
81
+ -body {
82
+ _add_step {^Match1 (\w+) Match2 (\d+) Match3 (\d+)$} {match1} {match2} {match3} { puts "Given RegExp $match" }
83
+ }
84
+ -returnCodes error
85
+ -result {The parameters for this procedure are regular_expression ?list_of_capture_variables? body}
86
+ }
87
+
88
+
89
+
90
+ #
91
+ # Test When
92
+ #
93
+ test When-1 {calling When adds a new entry to the STEPS list} {
94
+ -setup {
95
+ set ::STEPS [list]
96
+ }
97
+ -body {
98
+ When {^Regular Expression$} { puts "When RegExp" }
99
+ expr { [llength $::STEPS] == 1 }
100
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
101
+ }
102
+ -result 1
103
+ }
104
+
105
+
106
+
107
+ #
108
+ # Test Then
109
+ #
110
+ test Then-1 {calling Then adds a new entry to the STEPS list} {
111
+ -setup {
112
+ set ::STEPS [list]
113
+ }
114
+ -body {
115
+ Then {^Regular Expression$} { puts "Then RegExp" }
116
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
117
+ }
118
+ -result 1
119
+ }
120
+
121
+
122
+
123
+ #
124
+ # Test And
125
+ #
126
+ test And-1 {calling And adds a new entry to the STEPS list} {
127
+ -setup {
128
+ set ::STEPS [list]
129
+ }
130
+ -body {
131
+ And {^Regular Expression$} { puts "And RegExp" }
132
+ expr { [llength $::STEPS] == 1 && [llength [lindex $::STEPS 0]] == 3}
133
+ }
134
+ -result 1
135
+ }
136
+
137
+
138
+
139
+ #
140
+ # Test _search_steps procedure
141
+ #
142
+ test _search_steps-1 {_search_steps returns 0 if there are no existing steps} {
143
+ -setup {
144
+ set ::STEPS [list]
145
+ }
146
+ -body {
147
+ _search_steps {Unknown Regexp}
148
+ }
149
+ -result 0
150
+ }
151
+
152
+ test _search_steps-2 {_search_steps returns 0 if there are no matching steps} {
153
+ -setup {
154
+ set ::STEPS [list [list {^First Step$} {} {puts "First Step"}]]
155
+ }
156
+ -body {
157
+ _search_steps {Unknown Regexp}
158
+ }
159
+ -result 0
160
+ }
161
+
162
+ test _search_steps-3 {_search_steps returns 1 if there is a matching step} {
163
+ -setup {
164
+ set ::STEPS [list [list {^First Step$} {} {puts "First Step"}]]
165
+ }
166
+ -body {
167
+ _search_steps {First Step}
168
+ }
169
+ -result 1
170
+ }
171
+
172
+ test _search_steps-4 {_search_steps returns 1 if there is a matching step with multiple values in STEPS} {
173
+ -setup {
174
+ set ::STEPS [list \
175
+ [list {^First Step$} {} {puts "First Step"}] \
176
+ [list {^Second Step$} {} {puts "Second Step"}] \
177
+ ]
178
+ }
179
+ -body {
180
+ _search_steps {Second Step}
181
+ }
182
+ -result 1
183
+ }
184
+
185
+ test _search_steps-5 {_search_steps returns 1 and executes body of step if there is a matching step and execute is set to 1} {
186
+ -setup {
187
+ set ::STEPS [list \
188
+ [list {^First Step$} {} {puts "First Step"}] \
189
+ [list {^Second Step$} {} {puts "Second Step"}] \
190
+ ]
191
+ }
192
+ -body {
193
+ _search_steps {Second Step} {1}
194
+ }
195
+ -result 1
196
+ -match glob
197
+ -output {Second Step*}
198
+ }
199
+
200
+ test _search_steps-6 {_search_steps returns 1 and executes body of step if there is a matching step and execute is set to 1 with a parameter in the match} {
201
+ -setup {
202
+ set ::STEPS [list \
203
+ [list {^First Step$} {} {puts "First Step"}] \
204
+ [list {^Second (\w+)$} {match} {puts "Second $match"}] \
205
+ ]
206
+ }
207
+ -body {
208
+ _search_steps {Second Step} {1}
209
+ }
210
+ -result 1
211
+ -match glob
212
+ -output {Second Step*}
213
+ }
214
+
215
+ test _search_steps-7 {_search_steps returns 1 and executes body of step if there is a matching step and execute is set to 1 with 2 parameters in the match} {
216
+ -setup {
217
+ set ::STEPS [list \
218
+ [list {^First Step$} {} {puts "First Step"}] \
219
+ [list {^(\w+) (\w+)$} {match1 match2} {puts "$match1 $match2"}] \
220
+ ]
221
+ }
222
+ -body {
223
+ _search_steps {Second Step} {1}
224
+ }
225
+ -result 1
226
+ -match glob
227
+ -output {Second Step*}
228
+ }
229
+
230
+ # Testing multiline args
231
+ test _search_steps-8 {_search_steps returns 1 and executes body of step if there is a matching step, execute is set to 1 and there is a multiline_arg passed in} {
232
+ -setup {
233
+ set ::STEPS [list \
234
+ [list {^First Step$} {} {puts "First Step"}] \
235
+ [list {^Second Step:$} {content} {puts "$content"}] \
236
+ ]
237
+ }
238
+ -body {
239
+ _search_steps {Second Step:} {1} {Multiline Content}
240
+ }
241
+ -result 1
242
+ -match glob
243
+ -output {Multiline Content*}
244
+ }
245
+
246
+ test _search_steps-9 {_search_steps returns 1 and executes body of step if there is a matching step, execute is set to 1 and there is a multiline_arg passed in and there is a parameter match in the regexp} {
247
+ -setup {
248
+ set ::STEPS [list \
249
+ [list {^First Step$} {} {puts "First Step"}] \
250
+ [list {^Second (\w+):$} {match1 content} {puts "content=$content, match=$match1"}] \
251
+ ]
252
+ }
253
+ -body {
254
+ _search_steps {Second Step:} {1} {Multiline Content}
255
+ }
256
+ -result 1
257
+ -match glob
258
+ -output {content=Multiline Content, match=Step*}
259
+ }
260
+
261
+ #
262
+ # Cleanup
263
+ #
264
+ cleanupTests
265
+
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/lib/cucumber/tcl.rb CHANGED
@@ -1,44 +1,9 @@
1
- require 'cucumber/core/filter'
2
-
3
- module Cucumber
4
- module Tcl
5
- ActivateSteps = Cucumber::Core::Filter.new(:step_definitions) do
6
- def test_case(test_case)
7
- activated_steps = test_case.test_steps.map do |test_step|
8
- attempt_to_activate(test_step)
9
- end
10
- test_case.with_steps(activated_steps).describe_to receiver
11
- end
12
-
13
- private
14
-
15
- def attempt_to_activate(test_step)
16
- return test_step unless step_definitions.match?(test_step.name)
17
- test_step.with_action &step_definitions.action_for(test_step.name)
18
- end
19
- end
20
-
21
- require 'tcl'
22
- class StepDefinitions
23
- def initialize(path)
24
- raise ArgumentError, "cucumber-tcl entry point #{path} does not exist." unless File.exists?(path)
25
- @tcl = ::Tcl::Interp.load_from_file(path)
26
- end
27
-
28
- def match?(step_name)
29
- @tcl.proc('step_definition_exists').call(step_name) == "1"
30
- end
31
-
32
- def action_for(step_name)
33
- proc { @tcl.proc('execute_step_definition').call(step_name) }
34
- end
35
- end
36
- end
37
- end
1
+ require 'cucumber/tcl/activate_steps'
2
+ require 'cucumber/tcl/step_definitions'
38
3
 
39
4
  if respond_to?(:AfterConfiguration)
40
5
  AfterConfiguration do |config|
41
- step_definitions = Cucumber::Tcl::StepDefinitions.new('features/support/env.tcl')
6
+ step_definitions = Cucumber::Tcl::StepDefinitions.new(File.dirname(__FILE__) + '/tcl/framework.tcl')
42
7
  config.filters << Cucumber::Tcl::ActivateSteps.new(step_definitions)
43
8
  end
44
9
  end
@@ -0,0 +1,3 @@
1
+ proc execute_step_definition { step_name } {
2
+ return 0
3
+ }
@@ -1,10 +1,18 @@
1
1
  require 'cucumber/tcl'
2
+ require 'cucumber/core/ast'
2
3
 
3
4
  module Cucumber::Tcl
4
5
  describe StepDefinitions do
5
6
  it "can query for a step definition" do
6
- step_definitions = StepDefinitions.new(File.dirname(__FILE__) + '/steps.tcl')
7
- expect(step_definitions.match?('passing')).to be_truthy
7
+ step_definitions = StepDefinitions.new(File.dirname(__FILE__) + '/fixtures/everything_is_defined.tcl')
8
+ expect(step_definitions.match?(double(name: 'passing'))).to be_truthy
9
+ end
10
+
11
+ it "can activate a passing tcl step" do
12
+ step_definitions = StepDefinitions.new(File.dirname(__FILE__) + '/fixtures/everything_passes.tcl')
13
+ ast_step = double(multiline_arg: Cucumber::Core::Ast::EmptyMultilineArgument.new)
14
+ test_step = double(name: "a step", source: [ ast_step ])
15
+ expect { step_definitions.action_for(test_step).call }.not_to raise_error
8
16
  end
9
17
  end
10
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-tcl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Wynne
@@ -10,104 +10,104 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-02-06 00:00:00.000000000 Z
13
+ date: 2015-02-18 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ruby-tcl
17
17
  requirement: !ruby/object:Gem::Requirement
18
18
  requirements:
19
- - - ">="
19
+ - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.1.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
- - - ">="
26
+ - - ~>
27
27
  - !ruby/object:Gem::Version
28
- version: '0'
28
+ version: 0.1.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: cucumber-core
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
- - - ">="
33
+ - - ~>
34
34
  - !ruby/object:Gem::Version
35
- version: '0'
35
+ version: 1.1.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
- - - ">="
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: 1.1.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: cucumber
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
49
  version: 2.0.0.rc.4
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
- - - "~>"
54
+ - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  version: 2.0.0.rc.4
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: rspec
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "~>"
61
+ - - ~>
62
62
  - !ruby/object:Gem::Version
63
63
  version: '3.2'
64
64
  type: :development
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - "~>"
68
+ - - ~>
69
69
  - !ruby/object:Gem::Version
70
70
  version: '3.2'
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: aruba
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  requirements:
75
- - - "~>"
75
+ - - ~>
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0.6'
78
78
  type: :development
79
79
  prerelease: false
80
80
  version_requirements: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - "~>"
82
+ - - ~>
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0.6'
85
85
  - !ruby/object:Gem::Dependency
86
86
  name: yard
87
87
  requirement: !ruby/object:Gem::Requirement
88
88
  requirements:
89
- - - "~>"
89
+ - - ~>
90
90
  - !ruby/object:Gem::Version
91
91
  version: '0.8'
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
- - - "~>"
96
+ - - ~>
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0.8'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rake
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
- - - "~>"
103
+ - - ~>
104
104
  - !ruby/object:Gem::Version
105
105
  version: '10.0'
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
- - - "~>"
110
+ - - ~>
111
111
  - !ruby/object:Gem::Version
112
112
  version: '10.0'
113
113
  description: TCL plugin for Cucumber
@@ -116,45 +116,54 @@ executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - ".rspec"
119
+ - .rspec
120
120
  - Gemfile
121
121
  - README.md
122
122
  - Rakefile
123
+ - circle.yml
123
124
  - cucumber-tcl.gemspec
124
125
  - features/define_a_step.feature
126
+ - features/doc_strings.feature
125
127
  - features/support/aruba.rb
126
128
  - lib/cucumber/tcl.rb
129
+ - lib/cucumber/tcl/activate_steps.rb
130
+ - lib/cucumber/tcl/framework.tcl
131
+ - lib/cucumber/tcl/step_definitions.rb
132
+ - lib/cucumber/tcl/test/test_framework.tcl
127
133
  - lib/cucumber/tcl/version
134
+ - spec/cucumber/tcl/fixtures/everything_is_defined.tcl
135
+ - spec/cucumber/tcl/fixtures/everything_passes.tcl
128
136
  - spec/cucumber/tcl/step_definitions_spec.rb
129
- - spec/cucumber/tcl/steps.tcl
130
137
  homepage: https://github.com/cucumber/cucumber-ruby-tcl
131
138
  licenses:
132
139
  - MIT
133
140
  metadata: {}
134
141
  post_install_message:
135
142
  rdoc_options:
136
- - "--charset=UTF-8"
143
+ - --charset=UTF-8
137
144
  require_paths:
138
145
  - lib
139
146
  required_ruby_version: !ruby/object:Gem::Requirement
140
147
  requirements:
141
- - - ">="
148
+ - - '>='
142
149
  - !ruby/object:Gem::Version
143
150
  version: 1.9.3
144
151
  required_rubygems_version: !ruby/object:Gem::Requirement
145
152
  requirements:
146
- - - ">="
153
+ - - '>='
147
154
  - !ruby/object:Gem::Version
148
155
  version: '0'
149
156
  requirements: []
150
157
  rubyforge_project:
151
- rubygems_version: 2.2.2
158
+ rubygems_version: 2.0.14
152
159
  signing_key:
153
160
  specification_version: 4
154
- summary: cucumber-tcl-0.0.1
161
+ summary: cucumber-tcl-0.0.2
155
162
  test_files:
156
163
  - features/define_a_step.feature
164
+ - features/doc_strings.feature
157
165
  - features/support/aruba.rb
166
+ - spec/cucumber/tcl/fixtures/everything_is_defined.tcl
167
+ - spec/cucumber/tcl/fixtures/everything_passes.tcl
158
168
  - spec/cucumber/tcl/step_definitions_spec.rb
159
- - spec/cucumber/tcl/steps.tcl
160
169
  has_rdoc: