the 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +14 -4
- data/lib/the.rb +0 -6
- data/lib/the/cucumber.rb +1 -0
- data/lib/the/model_steps.rb +6 -0
- data/the.gemspec +1 -1
- metadata +4 -3
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# The
|
2
2
|
|
3
|
-
|
3
|
+
**TLDR**: A simple little DSL for Cucumber tests that work with ActiveRecord models.
|
4
4
|
|
5
5
|
## Why?
|
6
6
|
|
@@ -17,14 +17,24 @@ I have a common pattern in my cukes whenever the step talks about "the User" or
|
|
17
17
|
the(:user).should be_married_to('susan')
|
18
18
|
end
|
19
19
|
|
20
|
-
It's quite flexible, so you can pass `#the` a symbol
|
20
|
+
It's quite flexible, so you can pass `#the` a **symbol**, like in the example above, or a **class**, or a **string of a class name**. So, for example:
|
21
21
|
|
22
22
|
When /^the (\w+) eats the (\w+)$/ do |eater, eaten|
|
23
23
|
the(eater).eat(eaten)
|
24
24
|
end
|
25
25
|
|
26
|
-
|
26
|
+
Oh and it also understands a **hash of conditions**, just like `ActiveRecord::Base#find`, so you can do this:
|
27
|
+
|
28
|
+
When /^the User named (\w+) eats the fish$/ do |name|
|
29
|
+
the(:user, :name => name).eat(the(:fish))
|
30
|
+
end
|
31
|
+
|
32
|
+
In fact, there are a few **step definitions** defined for you, which you can enjoy for yourself by calling...
|
27
33
|
|
28
34
|
require 'the/model_steps'
|
29
35
|
|
30
|
-
...from somewhere inside your `features/step_definitions` folder.
|
36
|
+
...from somewhere inside your `features/step_definitions` folder. You'll have to look at the source for now if you want to know what they do.
|
37
|
+
|
38
|
+
If you just want the DSL, and none of these fancy step definitions, then try this for size:
|
39
|
+
|
40
|
+
require 'the/cucumber'
|
data/lib/the.rb
CHANGED
data/lib/the/cucumber.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
World(The::Dsl)
|
data/lib/the/model_steps.rb
CHANGED
data/the.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: the
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Wynne
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- .gitignore
|
32
32
|
- README.md
|
33
33
|
- lib/the.rb
|
34
|
+
- lib/the/cucumber.rb
|
34
35
|
- lib/the/model_steps.rb
|
35
36
|
- the.gemspec
|
36
37
|
has_rdoc: true
|