macros4cuke 0.2.12 → 0.2.13
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 +4 -0
- data/README.md +3 -3
- data/lib/macros4cuke/constants.rb +6 -3
- data/lib/macros4cuke/exceptions.rb +1 -1
- data/spec/macros4cuke/macro-collection_spec.rb +54 -0
- metadata +3 -2
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.2.13 / 2013-05-02
|
2
|
+
* [NEW] File `macro-collection_spec.rb`: partial spec file for the `MacroCollection` class.
|
3
|
+
* [FIX] `DuplicateMacroError#initialize`: Removed superfluous [ in error message.
|
4
|
+
|
1
5
|
## 0.2.12 / 2013-05-01
|
2
6
|
* [CHANGE] Method `Macros4Cuke#compile` raise an `EmptyArgumentError` exception when a line contains an empty or blank argument.
|
3
7
|
* [CHANGE] File `template-engine_spec.rb`: Added an example for error case mentioned in previous line.
|
data/README.md
CHANGED
@@ -62,11 +62,11 @@ $[sudo] gem install macros4cuke
|
|
62
62
|
|
63
63
|
### Setting up your Cucumber project ####
|
64
64
|
|
65
|
-
* Step 1: Add support for macros in your Cucumber project
|
66
|
-
In your `/features/support/` folder:
|
67
|
-
- Create a Ruby file (e.g. 'macro\_support.rb') with the following contents:
|
65
|
+
* Step 1: Add support for macros in your Cucumber project
|
68
66
|
|
69
67
|
```ruby
|
68
|
+
# /features/support/env.rb
|
69
|
+
# Add the two next lines
|
70
70
|
require 'macros4cuke'
|
71
71
|
World(Macros4Cuke::MacroStepSupport)
|
72
72
|
```
|
@@ -2,14 +2,17 @@
|
|
2
2
|
# Purpose: definition of Macros4Cuke constants.
|
3
3
|
|
4
4
|
module Macros4Cuke # Module used as a namespace
|
5
|
-
#
|
6
|
-
Version = '0.2.
|
5
|
+
# The version number of the gem.
|
6
|
+
Version = '0.2.13'
|
7
7
|
|
8
|
+
# Brief description of the gem.
|
8
9
|
Description = "Macros for Cucumber"
|
9
10
|
|
10
11
|
# Constant Macros4Cuke::RootDir contains the absolute path of Rodent's root directory. Note: it also ends with a slash character.
|
11
12
|
unless defined?(RootDir)
|
12
|
-
# The initialisation of constant RootDir is guarded in order to avoid multiple initialisation (not allowed for constants)
|
13
|
+
# The initialisation of constant RootDir is guarded in order to avoid multiple initialisation (not allowed for constants)
|
14
|
+
|
15
|
+
# The root folder of Macros4Cuke.
|
13
16
|
RootDir = begin
|
14
17
|
require 'pathname' # Load Pathname class from standard library
|
15
18
|
rootdir = Pathname(__FILE__).dirname.parent.parent.expand_path()
|
@@ -11,7 +11,7 @@ end # class
|
|
11
11
|
# that has the same phrase as an existing macro.
|
12
12
|
class DuplicateMacroError < Macros4CukeError
|
13
13
|
def initialize(aPhrase)
|
14
|
-
super("A macro-step with phrase '
|
14
|
+
super("A macro-step with phrase '#{aPhrase}' already exist.")
|
15
15
|
end
|
16
16
|
end # class
|
17
17
|
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# encoding: utf-8 -- You should see a paragraph character: §
|
2
|
+
# File: macro-collection_spec.rb
|
3
|
+
|
4
|
+
require_relative '../spec_helper'
|
5
|
+
require_relative '../../lib/macros4cuke/macro-collection' # Load the class under test
|
6
|
+
|
7
|
+
module Macros4Cuke # Open this namespace to get rid of module qualifier prefixes
|
8
|
+
|
9
|
+
describe MacroCollection do
|
10
|
+
|
11
|
+
before(:all) do
|
12
|
+
# Initialize the sole instance
|
13
|
+
MacroCollection.instance.init()
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:singleton) { MacroCollection.instance() }
|
17
|
+
|
18
|
+
context "Initialization:" do
|
19
|
+
it "should be empty" do
|
20
|
+
singleton.macro_steps.should be_empty
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
context "Provided services:" do
|
26
|
+
let(:sample_substeps) do
|
27
|
+
snippet = <<-SNIPPET
|
28
|
+
Given I landed in the homepage
|
29
|
+
When I click "Sign in"
|
30
|
+
And I fill in "Username" with "<userid>"
|
31
|
+
And I fill in "Password" with "<password>"
|
32
|
+
And I click "Submit"
|
33
|
+
SNIPPET
|
34
|
+
|
35
|
+
snippet
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should accept the addition of a new macro-step" do
|
39
|
+
phrase = "[enter my credentials]"
|
40
|
+
lambda { singleton.add_macro(phrase, sample_substeps, true)}.should_not raise_error
|
41
|
+
singleton.should have(1).macro_steps
|
42
|
+
|
43
|
+
# Error case: inserting another macro with same phrase.
|
44
|
+
error_message = "A macro-step with phrase '[enter my credentials]' already exist."
|
45
|
+
lambda { singleton.add_macro(phrase, sample_substeps, true) }.should raise_error(Macros4Cuke::DuplicateMacroError, error_message)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end # describe
|
50
|
+
|
51
|
+
end # module
|
52
|
+
|
53
|
+
|
54
|
+
# 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.13
|
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-05-
|
12
|
+
date: 2013-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- features/support/env.rb
|
72
72
|
- features/support/macro_support.rb
|
73
73
|
- spec/spec_helper.rb
|
74
|
+
- spec/macros4cuke/macro-collection_spec.rb
|
74
75
|
- spec/macros4cuke/macro-step_spec.rb
|
75
76
|
- spec/macros4cuke/template-engine_spec.rb
|
76
77
|
homepage: https://github.com/famished-tiger/Macros4Cuke
|