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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # The
2
2
 
3
- *TLDR* a simple little DSL for Cucumber tests that work with ActiveRecord models.
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, like in the example above, or a class, or a string of a class name. So, for example:
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
- In fact, there are a few steps defined for you, which you can have for yourself by calling...
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
@@ -1,7 +1,3 @@
1
- module Match
2
- DomainEntity = /[A-z]\w+/
3
- end
4
-
5
1
  module The
6
2
  module Dsl
7
3
  def the(thing, conditions = {})
@@ -22,5 +18,3 @@ module The
22
18
  end
23
19
  end
24
20
  end
25
-
26
- World(The::Dsl)
@@ -0,0 +1 @@
1
+ World(The::Dsl)
@@ -1,3 +1,9 @@
1
+ require 'the/cucumber'
2
+
3
+ module Match
4
+ DomainEntity = /[A-z]\w+/
5
+ end
6
+
1
7
  Given /^there is a (#{Match::DomainEntity}) named "([^"]*)"$/ do |type, name|
2
8
  Factory(type.underscore.to_sym, :name => name)
3
9
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "the"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.3"
4
4
 
5
5
  s.required_rubygems_version = '>= 1.3.5'
6
6
  s.authors = ["Matt Wynne"]
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: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
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