macros4cuke 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +3 -0
- data/examples/i18n/fr/cucumber.yml +6 -0
- data/examples/i18n/fr/features/demo01-fr.feature +27 -0
- data/examples/i18n/fr/features/step_definitions/demo_steps.rb +14 -0
- data/examples/i18n/fr/features/step_definitions/use_macro_steps.rb +27 -0
- data/examples/i18n/fr/features/support/macro_support.rb +16 -0
- data/lib/macros4cuke/constants.rb +1 -1
- metadata +6 -1
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 0.2.20 / 2013-05-06
|
2
|
+
* [NEW] Added `examples` folder with a first example of an internationalized customisation of __Macros4Cuke__.
|
3
|
+
|
1
4
|
## 0.2.19 / 2013-05-06
|
2
5
|
* [CHANGE] Added validation of macro argument names in new `Engine::parse_tag` method.
|
3
6
|
* [CHANGE] InvalidCharError exception added.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# language: fr
|
2
|
+
Fonctionnalité: Macro-pas
|
3
|
+
Afin d'écrire des scénarios plus facilement
|
4
|
+
En tant qu'utilisateur de Cucumber
|
5
|
+
Je souhaite pouvoir créer des macro-étapes
|
6
|
+
|
7
|
+
Scénario: Définition d'un macro-pas (de scénario)
|
8
|
+
Etant donné que je crée le pas "Quand j'[imprime le texte <un_texte>]" qui équivaut à:
|
9
|
+
"""
|
10
|
+
Quand j'imprime "<un_texte>" à l'écran
|
11
|
+
Et je garde "<un_texte>" en mémoire
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scénario: Utilisation d'un macro-pas (de scénario)
|
15
|
+
Quand j'[imprime le texte "Bonjour!"]
|
16
|
+
|
17
|
+
Scénario: Définition d'un macro-pas appelant des macro-pas!
|
18
|
+
Etant donné que je crée le pas "Quand j'[imprime le texte <un_texte> trois fois]" qui équivaut à:
|
19
|
+
"""
|
20
|
+
Quand j'[imprime le texte "<un_texte>"]
|
21
|
+
Quand j'[imprime le texte "<un_texte>"]
|
22
|
+
Quand j'[imprime le texte "<un_texte>"]
|
23
|
+
"""
|
24
|
+
|
25
|
+
Scénario: Utilisation du dernier macro-pas (de scénario)
|
26
|
+
Quand j'[imprime le texte "Trois fois!" trois fois]
|
27
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Quelques définitions de pas de scénarios Cucumber.
|
3
|
+
require 'stringio'
|
4
|
+
|
5
|
+
Quand(/^j'imprime "(.*?)" à l'écran$/) do |some_text|
|
6
|
+
$stderr.puts some_text
|
7
|
+
end
|
8
|
+
|
9
|
+
Quand(/^je garde "(.*?)" en mémoire$/) do |some_text|
|
10
|
+
@output ||= StringIO.new('')
|
11
|
+
@output.puts some_text
|
12
|
+
end
|
13
|
+
|
14
|
+
# End of file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Définitions de pas de scénarios utilisant Macros4Cuke.
|
3
|
+
|
4
|
+
|
5
|
+
Etantdonné(/^que je crée le pas "(?:Soit|Quand|Alors) j(?:e |')\[((?:[^\\\]]|\\.)+)\](:?)" qui équivaut à:$/) do |macro_phrase, colon_capture, template|
|
6
|
+
use_table = (colon_capture == ':')
|
7
|
+
add_macro(macro_phrase, template, use_table)
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
Quand(/^j(?:e |')\[((?:[^\\\]]|\\.)+)\]$/) do |macro_phrase|
|
12
|
+
invoke_macro(macro_phrase) # This will call the macro with the given phrase
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
Quand(/^j(?:e |')\[([^\]]+)\]:$/) do |macro_phrase, table_argument|
|
17
|
+
# Ensure that the second argument is of the correct type
|
18
|
+
unless table_argument.kind_of?(Cucumber::Ast::Table)
|
19
|
+
raise Macros4Cuke::DataTableNotFound, "This step must have a data table as an argument."
|
20
|
+
end
|
21
|
+
|
22
|
+
# This will call the macro with the given phrase.
|
23
|
+
# The second argument consists of an array with couples of the kind: [argument name, actual value]
|
24
|
+
invoke_macro(macro_phrase, table_argument.raw)
|
25
|
+
end
|
26
|
+
|
27
|
+
# End of file
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# encoding: utf-8 You should see a paragraph character: §
|
2
|
+
# File: macro_support.rb
|
3
|
+
# Purpose: Add the support for macros in Cucumber.
|
4
|
+
# This file is meant to be put next to the 'env.rb' file of your Cucumeber project.
|
5
|
+
|
6
|
+
|
7
|
+
# Macros4Cuke step one: Load modules and classes from the gem.
|
8
|
+
require 'macros4cuke'
|
9
|
+
|
10
|
+
|
11
|
+
# Macros4Cuke step two: extend the world object with the mix-in module
|
12
|
+
# that adds the support for macros in Cucumber.
|
13
|
+
World(Macros4Cuke::MacroStepSupport)
|
14
|
+
|
15
|
+
|
16
|
+
# End of file
|
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.
|
4
|
+
version: 0.2.20
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -79,6 +79,11 @@ files:
|
|
79
79
|
- lib/macros4cuke/macro-step-support.rb
|
80
80
|
- lib/macros4cuke/macro-step.rb
|
81
81
|
- lib/macros4cuke/templating/engine.rb
|
82
|
+
- examples/i18n/fr/cucumber.yml
|
83
|
+
- examples/i18n/fr/features/demo01-fr.feature
|
84
|
+
- examples/i18n/fr/features/step_definitions/demo_steps.rb
|
85
|
+
- examples/i18n/fr/features/step_definitions/use_macro_steps.rb
|
86
|
+
- examples/i18n/fr/features/support/macro_support.rb
|
82
87
|
- features/demo01.feature
|
83
88
|
- features/demo02.feature
|
84
89
|
- features/demo03.feature
|