macros4cuke 0.2.15 → 0.2.16
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/.simplecov +5 -0
- data/CHANGELOG.md +4 -0
- data/features/support/env.rb +5 -1
- data/lib/macros4cuke/constants.rb +1 -1
- data/lib/macros4cuke/exceptions.rb +1 -1
- data/spec/macros4cuke/macro-step-support_spec.rb +41 -10
- data/spec/spec_helper.rb +2 -0
- metadata +19 -2
data/.simplecov
ADDED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 0.2.16 / 2013-05-04
|
|
2
|
+
* [FEATURE] Added dependency to SimpleCov. It is used to measure test code coverage (the combination of Cucumber and RSpec result in 95.9% code coverage).
|
|
3
|
+
* [CHANGE] File `macro-step-support_spec.rb`: Added one RSpec example
|
|
4
|
+
|
|
1
5
|
## 0.2.15 / 2013-05-03
|
|
2
6
|
* [CHANGE] File `macro-step-support_spec.rb`: Added one RSpec example.
|
|
3
7
|
* [FIX] Updated gemspec.
|
data/features/support/env.rb
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
# Purpose: Allow Cucumber to load the sample application configuration and hooks.
|
|
4
4
|
# It also demonstrate what to do in your env.rb file to use the Macros4Cuke gem.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
begin
|
|
7
|
+
require 'simplecov'
|
|
8
|
+
rescue LoadError
|
|
9
|
+
# Gobble silently the exception if simplecov isn't installed.
|
|
10
|
+
end
|
|
7
11
|
|
|
8
12
|
module DemoMacros4Cuke # Use the module as a namespace
|
|
9
13
|
|
|
@@ -47,7 +47,7 @@ end # class
|
|
|
47
47
|
# Raised when one invokes a macro-step with an unknown phrase.
|
|
48
48
|
class UnknownMacroError < Macros4CukeError
|
|
49
49
|
def initialize(aPhrase)
|
|
50
|
-
super("Unknown macro-step with phrase: '
|
|
50
|
+
super("Unknown macro-step with phrase: '#{aPhrase}'.")
|
|
51
51
|
end
|
|
52
52
|
end # class
|
|
53
53
|
|
|
@@ -9,19 +9,26 @@ module Macros4Cuke # Open the module to avoid lengthy qualified names
|
|
|
9
9
|
# Class created just for testing purposes.
|
|
10
10
|
class MyWorld
|
|
11
11
|
include Macros4Cuke::MacroStepSupport
|
|
12
|
+
|
|
13
|
+
# The list of encountered sub-steps
|
|
14
|
+
attr_reader(:substeps)
|
|
15
|
+
|
|
16
|
+
# Let's mimicks the behaviour of a Cucumber::RbSupport::RbWorld
|
|
17
|
+
def steps(substep_text)
|
|
18
|
+
@substeps ||= {}
|
|
19
|
+
@substeps << substep_text
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
|
|
12
23
|
end # class
|
|
13
24
|
|
|
14
25
|
describe MacroStepSupport do
|
|
15
|
-
# Rule to build a
|
|
16
|
-
let(:world)
|
|
17
|
-
w = Object.new
|
|
18
|
-
w.extend(Macros4Cuke::MacroStepSupport)
|
|
19
|
-
w
|
|
20
|
-
end
|
|
26
|
+
# Rule to build a custom world object
|
|
27
|
+
let(:world) { MyWorld.new }
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
let(:m1_phrase) { "enter the credentials" }
|
|
30
|
+
|
|
31
|
+
let(:m1_substeps) do
|
|
25
32
|
ssteps = <<-SNIPPET
|
|
26
33
|
Given I landed in the homepage
|
|
27
34
|
When I click "Sign in"
|
|
@@ -30,7 +37,9 @@ describe MacroStepSupport do
|
|
|
30
37
|
And I click "Submit"
|
|
31
38
|
SNIPPET
|
|
32
39
|
ssteps
|
|
33
|
-
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context "Defining macro(s):" do
|
|
34
43
|
it "should add valid new macro" do
|
|
35
44
|
lambda { world.add_macro(m1_phrase, m1_substeps, true) }.should_not raise_error
|
|
36
45
|
end
|
|
@@ -47,6 +56,28 @@ SNIPPET
|
|
|
47
56
|
lambda { world.add_macro("fill in the credentials", m1_substeps, false) }.should raise_error(Macros4Cuke::UnreachableSubstepArgument, error_message)
|
|
48
57
|
end
|
|
49
58
|
end # context
|
|
59
|
+
|
|
60
|
+
context "Invoking macro(s)" do
|
|
61
|
+
|
|
62
|
+
it "should complain when invoking an unknown macro-step" do
|
|
63
|
+
phrase_unknown = "dream of a perfect world"
|
|
64
|
+
|
|
65
|
+
error_message = "Unknown macro-step with phrase: 'dream of a perfect world'."
|
|
66
|
+
lambda { world.invoke_macro(phrase_unknown) }.should raise_error( Macros4Cuke::UnknownMacroError, error_message)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
end # context
|
|
70
|
+
|
|
71
|
+
context "Clearing macro(s)" do
|
|
72
|
+
|
|
73
|
+
it "should clear all macros" do
|
|
74
|
+
lambda { world.clear_macros() }.should_not raise_error
|
|
75
|
+
|
|
76
|
+
# Control the post-condition
|
|
77
|
+
MacroCollection::instance.macro_steps.should be_empty
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
end # context
|
|
50
81
|
|
|
51
82
|
end # describe
|
|
52
83
|
|
data/spec/spec_helper.rb
CHANGED
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.16
|
|
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-04 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: cucumber
|
|
@@ -43,12 +43,29 @@ dependencies:
|
|
|
43
43
|
- - ! '>='
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '2.00'
|
|
46
|
+
- !ruby/object:Gem::Dependency
|
|
47
|
+
name: simplecov
|
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
|
49
|
+
none: false
|
|
50
|
+
requirements:
|
|
51
|
+
- - ! '>='
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: 0.5.0
|
|
54
|
+
type: :development
|
|
55
|
+
prerelease: false
|
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
+
none: false
|
|
58
|
+
requirements:
|
|
59
|
+
- - ! '>='
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 0.5.0
|
|
46
62
|
description: Create your own macros in your Cucumber scenarios.
|
|
47
63
|
email:
|
|
48
64
|
executables: []
|
|
49
65
|
extensions: []
|
|
50
66
|
extra_rdoc_files: []
|
|
51
67
|
files:
|
|
68
|
+
- .simplecov
|
|
52
69
|
- .yardopts
|
|
53
70
|
- cucumber.yml
|
|
54
71
|
- CHANGELOG.md
|