macros4cuke 0.2.02 → 0.2.04

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY.md CHANGED
@@ -1,8 +1,16 @@
1
+ ## [0.2.04]
2
+ ### Fixes:
3
+ * Class MacroCollection#add_macro: typo correction.
4
+
5
+ ## [0.2.03]
6
+ ### Changes:
7
+ * Regexp of defining step is more general: it accepts the Gherkin adverbs Given, When, Then, And.
8
+
9
+
1
10
  ## [0.2.02]
2
11
  ### Changes:
3
12
  * Added an example in template-engine_spec.rb file.
4
13
 
5
-
6
14
  ### Documentation:
7
15
  * Expanded the README.md file.
8
16
 
data/README.md CHANGED
@@ -4,11 +4,10 @@ Macros4Cuke
4
4
  _Add macros to your Cucumber scenarios._
5
5
  [Homepage](https://github.com/famished-tiger/Macros4Cuke)
6
6
 
7
- __Macros4Cuke__ gives you the opportunity to factor out repeated steps
8
- in your Cucumber scenarios. You can create (macro-)steps directly in feature files.
9
- To each macro-step, it is possible to associate a sequence of sub-steps
10
- that will be executed every time a macro-step occurs in a scenario.
11
-
7
+ __Macros4Cuke__ is a lightweight library that adds a macro facility your Cucumber scenarios.
8
+ In short, you can create any new step that replaces a sequence of lower-level steps.
9
+ All this can be done directly in your feature files without programming step definitions.
10
+
12
11
  ### Highlights ###
13
12
  * Works with out-of-the-box Cucumber
14
13
  * Simple installation and setup (no programming required),
@@ -37,7 +36,7 @@ That macro-step can then be used in a scenario like this:
37
36
  When I [enter my userid "jdoe" and password "hello-world"]
38
37
  ```
39
38
 
40
- When it is executed, the last macro-step (invokation) as the same effect as:
39
+ Once it is executing, the macro-step as the same effect as:
41
40
  ```cucumber
42
41
  Given I landed in the homepage
43
42
  When I click "Sign in"
@@ -85,15 +84,29 @@ That's it! Now you can start writing macros in your Cucumber project.
85
84
 
86
85
  ## Getting started ##
87
86
  Working with a macro-step is a two-stages process:
88
- 1. First, the definition of a new macro-step
89
- 2. Second, the use of that macro-step in a scenario.
87
+ 1. Defining a new macro-step
88
+ 2. Using that macro-step in a scenario.
90
89
 
91
- Let's begin by taking a closer look at the definition step.
90
+ Let's begin by taking a closer look at the definition part.
92
91
  ### Defining a macro-step ###
93
- There are three questions to keep in mind when creating a new macro-step:
94
- 1. What is its syntax?
95
- 2. What are its substeps?
96
- 3. Does it need arguments?
92
+ To create a macro-step, you'll need to use a _defining_ step bundled with Macros4Cuke.
93
+ It is a rather unusual Cucumber step in the sense that its sole purpose is to build another step!
94
+ The defining step follows the general pattern:
95
+ ```cucumber
96
+ Given I define the step "When I [some phrase]" to mean:
97
+ """
98
+ # A sequence of sub-steps comes here
99
+ """
100
+ ```
101
+
102
+ The defining step has two key components:
103
+ 1. The quoted sentence ```"When I [some phrase]"```. That part
104
+ specifies the syntax of your future macro-step.
105
+ 2. The multiline text enclosed between the triple quotes (""") and immediately follows the
106
+ the defining step. It is the place where the sub-steps are listed.
107
+
108
+ These points are detailed
109
+
97
110
 
98
111
  #### Specifying the syntax of a macro-step ####
99
112
  Let's begin with a simple example:
@@ -164,9 +177,13 @@ enumerates the sub-steps associated with the macro-step. A pleasing aspect is th
164
177
  And I click "Sign in"
165
178
  """
166
179
  ```
167
-
180
+ TODO
181
+ There are three questions to keep in mind when creating a new macro-step:
182
+ 1. What is its syntax?
183
+ 2. What are its substeps?
184
+ 3. Does it need arguments?
168
185
  ---
169
186
 
170
187
  Copyright
171
188
  ---------
172
- Copyright (c) 2013, Dimitri Geshef. See [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
189
+ Copyright (c) 2013, Dimitri Geshef. Macros4Cuke is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Macros4Cuke/blob/master/LICENSE.txt) for details.
data/lib/macro_steps.rb CHANGED
@@ -13,8 +13,7 @@
13
13
  # And I fill in "Password" with "unguessable"
14
14
  # And I click "Submit"
15
15
  # """
16
-
17
- Given(/^I define the step "When I \[((?:[^\\\]]|\\.)+\]:?)" to mean:$/) do |macro_phrase, template|
16
+ Given(/^I define the step "(?:When|Given|Then|And) I \[((?:[^\\\]]|\\.)+\]:?)" to mean:$/) do |macro_phrase, template|
18
17
  add_macro(macro_phrase, template)
19
18
  end
20
19
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Macros4Cuke # Module used as a namespace
5
5
  # This constant keeps the current version of the gem.
6
- Version = '0.2.02'
6
+ Version = '0.2.04'
7
7
 
8
8
  Description = "Macros for Cucumber"
9
9
 
@@ -38,10 +38,7 @@ public
38
38
  # Prevent collision of macros (macros with same phrase).
39
39
  # This can occur if a macro was defined in a background section.
40
40
  # An exception is raised if the phrase syntax of both macros are the
41
- if find_macro(aPhrase)
42
- pp find_macro(aPhrase)
43
- raise DuplicateMacroError.new(aPhrase)
44
- end
41
+ raise DuplicateMacroError.new(aPhrase) if find_macro(aPhrase)
45
42
 
46
43
  @macro_steps[new_macro.name] = new_macro
47
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: macros4cuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.02
4
+ version: 0.2.04
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-04-26 00:00:00.000000000 Z
12
+ date: 2013-04-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -59,10 +59,7 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '2.00'
62
- description: ! "\tMacros4Cuke is a lightweight library that adds a macro facility
63
- your Cucumber scenarios.\n In short, you can create any new step that replaces
64
- a sequence of lower-level steps.\n All this can be done directly in your feature
65
- files without programming step definitions.\n"
62
+ description: Create your own macros in your Cucumber scenarios.
66
63
  email: famished.tiger@yahoo.com
67
64
  executables: []
68
65
  extensions: []