simple_bdd 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +47 -32
- data/lib/simple_bdd/rspec.rb +5 -0
- data/lib/simple_bdd/version.rb +1 -1
- data/spec/rspec_spec.rb +18 -0
- data/spec/spec_helper.rb +1 -1
- metadata +15 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 852885477abe136c0b58509e089f22aab842661e
|
4
|
+
data.tar.gz: 7feaa604ec7b4841ffb5f918ac977a71bca73e9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e18bffd470b4116a1d3676048a9ed7b18c77fabe7e81f8c85357da527042bfe49a803b5bdac83704dc1c5ab1717424e6da0181b27670cae21f75a9f77f15cc7c
|
7
|
+
data.tar.gz: 0fef3a1d10d3621c003fb8b012340c13b1e9f2f7da0a3a5b563195abfe1788eabc454347c945852e5a320443a1ba343efdde8e2dd7084daee85833a23374d2f9
|
data/README.md
CHANGED
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
Simple BDD offers basic Behaviour Driven Development language syntax. It enables tests to take steps to become more declaritive than imperiative by hiding the implementation and revealing test intent. It can be used in any test framework as it's just a way to keep the collaborative business language within a test by calling methods which directly relate to the step in the test.
|
4
4
|
|
5
|
-
|
6
5
|
## Installation
|
7
6
|
|
8
7
|
Add this line to your application's Gemfile:
|
9
8
|
|
10
|
-
|
9
|
+
``` ruby
|
10
|
+
gem 'simple_bdd'
|
11
|
+
```
|
11
12
|
|
12
13
|
And then execute:
|
13
14
|
|
@@ -21,55 +22,69 @@ Or install it yourself as:
|
|
21
22
|
|
22
23
|
### Standard Usage
|
23
24
|
|
24
|
-
The following will call commented method in scope of the current class or module. (Every RSpec
|
25
|
+
The following will call commented method in scope of the current class or module. (Every RSpec `describe` block is an anonymous class.)
|
25
26
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
``` ruby
|
28
|
+
[Gg]iven "Some state" # calls some_state
|
29
|
+
[Ww]hen "this happens" # calls this_happens
|
30
|
+
[Tt]hen "this change occurs" # calls this_change_occurs
|
31
|
+
[Bb]ut "this other thing still happens" # calls this_other_thing_still_happens
|
32
|
+
[Aa]nd "this other side effect happens" # calls this_other_side_effect_happens
|
33
|
+
```
|
31
34
|
|
32
35
|
## Behavior Usage
|
33
36
|
|
34
37
|
Some additional methods allow you to group related behaviors in your tests:
|
35
38
|
|
36
|
-
|
39
|
+
``` ruby
|
40
|
+
Given "Admin is signed in"
|
37
41
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
+
behavior "admin can manage widgets" do
|
43
|
+
When "Admin views all widgets"
|
44
|
+
Then "Admin sees the first widget"
|
45
|
+
end
|
42
46
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
+
behavior "admin can manage factories" do
|
48
|
+
When "Admin views all factories"
|
49
|
+
Then "Admin sees the first factory"
|
50
|
+
end
|
51
|
+
```
|
47
52
|
|
48
|
-
Any of the following names can be substituted for
|
53
|
+
Any of the following names can be substituted for `behavior` above:
|
49
54
|
|
50
|
-
* and_by
|
51
|
-
* behaves_like
|
52
|
-
* behavior
|
53
|
-
* behaviour
|
54
|
-
* by
|
55
|
-
* it_also
|
55
|
+
* `and_by`
|
56
|
+
* `behaves_like`
|
57
|
+
* `behavior`
|
58
|
+
* `behaviour`
|
59
|
+
* `by`
|
60
|
+
* `it_also`
|
56
61
|
|
57
62
|
## RSpec
|
58
63
|
|
59
|
-
|
64
|
+
To use SimpleBDD in your tests, simply add the following line to your spec helper:
|
65
|
+
|
66
|
+
``` ruby
|
67
|
+
require 'simple_bdd/rspec'
|
68
|
+
```
|
69
|
+
|
70
|
+
Or, if you want to have more control, you can do this instead:
|
60
71
|
|
61
|
-
|
72
|
+
``` ruby
|
73
|
+
require 'simple_bdd'
|
62
74
|
|
63
|
-
|
64
|
-
|
65
|
-
|
75
|
+
RSpec.configure do |config|
|
76
|
+
config.include SimpleBdd
|
77
|
+
end
|
78
|
+
```
|
66
79
|
|
67
80
|
By default, SimpleBDD marks specs pending on missing step implementations.
|
68
81
|
You can change this behavior to raise an error instead in the spec helper:
|
69
82
|
|
70
|
-
|
71
|
-
|
72
|
-
|
83
|
+
``` ruby
|
84
|
+
RSpec.configure do |config|
|
85
|
+
config.raise_error_on_missing_step_implementation = true
|
86
|
+
end
|
87
|
+
```
|
73
88
|
|
74
89
|
## Contributing
|
75
90
|
|
data/lib/simple_bdd/version.rb
CHANGED
data/spec/rspec_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'simple_bdd/rspec' do
|
4
|
+
it 'includes SimpleBdd in RSpec' do
|
5
|
+
Given 'some state'
|
6
|
+
When 'this happens'
|
7
|
+
Then 'this change occurs'
|
8
|
+
end
|
9
|
+
|
10
|
+
def some_state
|
11
|
+
end
|
12
|
+
|
13
|
+
def this_happens
|
14
|
+
end
|
15
|
+
|
16
|
+
def this_change_occurs
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_bdd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robbie Clutton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: zeus
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Gherkin methods that turn strings into methods
|
@@ -59,16 +59,18 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
63
|
-
- .rspec
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
64
|
- Gemfile
|
65
65
|
- LICENSE.txt
|
66
66
|
- README.md
|
67
67
|
- Rakefile
|
68
68
|
- lib/simple_bdd.rb
|
69
|
+
- lib/simple_bdd/rspec.rb
|
69
70
|
- lib/simple_bdd/version.rb
|
70
71
|
- simple_bdd.gemspec
|
71
72
|
- spec/pending_feature_spec.rb
|
73
|
+
- spec/rspec_spec.rb
|
72
74
|
- spec/simple_bdd_spec.rb
|
73
75
|
- spec/spec_helper.rb
|
74
76
|
homepage: ''
|
@@ -80,12 +82,12 @@ require_paths:
|
|
80
82
|
- lib
|
81
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
84
|
requirements:
|
83
|
-
- -
|
85
|
+
- - ">="
|
84
86
|
- !ruby/object:Gem::Version
|
85
87
|
version: '0'
|
86
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
89
|
requirements:
|
88
|
-
- -
|
90
|
+
- - ">="
|
89
91
|
- !ruby/object:Gem::Version
|
90
92
|
version: '0'
|
91
93
|
requirements: []
|
@@ -96,5 +98,6 @@ specification_version: 4
|
|
96
98
|
summary: Gherkin methods that turn strings into methods
|
97
99
|
test_files:
|
98
100
|
- spec/pending_feature_spec.rb
|
101
|
+
- spec/rspec_spec.rb
|
99
102
|
- spec/simple_bdd_spec.rb
|
100
103
|
- spec/spec_helper.rb
|