rspec-example_steps 3.0.1 → 3.0.2
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.
- checksums.yaml +4 -4
- data/README.md +120 -98
- data/lib/rspec/example_steps/documentation_formatter.rb +1 -1
- data/rspec-example_steps.gemspec +1 -1
- data/spec/regression_spec.rb +17 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 489096c9a1854033941f9011671224109ba01512
|
4
|
+
data.tar.gz: 3e60360c4d30279ed99788e14155957ffb9c90ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27690c06fa608053e3667440b604f5f9fab8170a5c98284e649f19759f4a731af287359c636ca532dfe58b688974ac264c0d3c76d389537a81d89a874a8b5d19
|
7
|
+
data.tar.gz: a83438d88b9168dad1fcb861ed5dafb50ea25d8d8a459ffde849e4a8b5da157630b766e160160e52d82fc4e0bfc70b5a8a418e38b5fed76bb3cc18d61196594e
|
data/README.md
CHANGED
@@ -2,45 +2,63 @@
|
|
2
2
|
|
3
3
|
Given/When/Then/And/But steps for RSpec examples
|
4
4
|
|
5
|
+
### Description
|
6
|
+
|
7
|
+
This gem brings two major functionality to your `spec/features`
|
8
|
+
|
9
|
+
* Verbosity for rspec documentation formatter.
|
10
|
+
* Ability to comment or describe set of actions in example into some step.
|
11
|
+
|
5
12
|
### Installation
|
6
13
|
|
7
|
-
* For rspec v2 use gem v0.2.x or branch
|
8
|
-
* For rspec v3 user gem v3.x.x or master
|
14
|
+
* For rspec v2 use gem **v0.2.x** or rspec2 branch
|
15
|
+
* For rspec v3 user gem **v3.x.x** or master branch
|
9
16
|
|
10
|
-
|
11
|
-
|
12
|
-
|
17
|
+
```ruby
|
18
|
+
gem 'rspec-example_steps'
|
19
|
+
```
|
20
|
+
|
21
|
+
Add to `spec/spec_helper.rb`
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require 'rspec/example_steps'
|
25
|
+
```
|
13
26
|
|
14
27
|
### Example
|
15
28
|
|
16
|
-
|
29
|
+
`spec/features/search_spec.rb`
|
17
30
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
31
|
+
```ruby
|
32
|
+
context 'Searching' do
|
33
|
+
Steps 'Result found' do
|
34
|
+
Given 'I am on search page' do
|
35
|
+
visit '/search'
|
36
|
+
expect(page).to have_content('Search')
|
37
|
+
end
|
24
38
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
39
|
+
When 'I search something' do
|
40
|
+
fill_in 'Search', with: 'John'
|
41
|
+
click_button 'Go'
|
42
|
+
end
|
29
43
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
44
|
+
Then 'I should see result' do
|
45
|
+
expect(page).to have_content('Result')
|
34
46
|
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
```
|
35
50
|
|
36
51
|
### Documentation formatting output:
|
37
52
|
|
38
|
-
|
39
|
-
User succesfully replaces device
|
40
|
-
Given I am on search page
|
41
|
-
When I search something
|
42
|
-
Then I should see result
|
53
|
+
`rspec -fd spec/features/search_spec.rb`
|
43
54
|
|
55
|
+
<pre>
|
56
|
+
Searching
|
57
|
+
User succesfully replaces device
|
58
|
+
Given I am on search page
|
59
|
+
When I search something
|
60
|
+
Then I should see result
|
61
|
+
</pre>
|
44
62
|
|
45
63
|
### Shared steps
|
46
64
|
|
@@ -50,42 +68,43 @@ Shared _steps_ behavior is simular to shared _example_ but context is example no
|
|
50
68
|
|
51
69
|
### Example with shared steps
|
52
70
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
71
|
+
```ruby
|
72
|
+
shared_steps 'login' do
|
73
|
+
When 'I go to login page' do
|
74
|
+
visit '/login'
|
75
|
+
end
|
76
|
+
When 'I put credentials' do
|
77
|
+
fill_in 'Login', with: 'jack@example.com'
|
78
|
+
fill_in 'Password', with: 'password'
|
79
|
+
end
|
80
|
+
Then 'I should be logged in' do
|
81
|
+
expect(page).to have_content('Welcome jack@example.com')
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
shared_steps 'logout' do
|
86
|
+
visit '/logout'
|
87
|
+
expect(page.status_code).to eq(200)
|
88
|
+
end
|
89
|
+
|
90
|
+
context 'user flow'
|
91
|
+
Steps 'User updates profile description' do
|
92
|
+
include_steps 'login'
|
93
|
+
When 'I update profile description' do
|
94
|
+
...
|
70
95
|
end
|
96
|
+
include_steps 'logout'
|
97
|
+
end
|
71
98
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
...
|
77
|
-
end
|
78
|
-
include_steps "logout"
|
79
|
-
end
|
80
|
-
|
81
|
-
Steps "User updates profile avatar" do
|
82
|
-
include_steps "login"
|
83
|
-
When "I update profile avatar" do
|
84
|
-
...
|
85
|
-
end
|
86
|
-
include_steps "logout"
|
87
|
-
end
|
99
|
+
Steps 'User updates profile avatar' do
|
100
|
+
include_steps 'login'
|
101
|
+
When 'I update profile avatar' do
|
102
|
+
...
|
88
103
|
end
|
104
|
+
include_steps 'logout'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
```
|
89
108
|
|
90
109
|
### Passing arguments to shared steps
|
91
110
|
|
@@ -93,51 +112,54 @@ It's possible to customize shared steps. See example
|
|
93
112
|
|
94
113
|
### Example with shared steps with arguments
|
95
114
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
115
|
+
```ruby
|
116
|
+
shared_steps 'login' do |email, password|
|
117
|
+
When 'I go to login page' do
|
118
|
+
page.visit '/login'
|
119
|
+
end
|
120
|
+
When 'I put credentials' do
|
121
|
+
fill_in 'Login', with: email
|
122
|
+
fill_in 'Password', with: password
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
shared_steps 'invalid login' do
|
127
|
+
Then 'I should see login error' do
|
128
|
+
...
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
Steps 'User provides wrong email' do
|
133
|
+
include_steps 'login', 'jack', 'qwerty'
|
134
|
+
include_steps 'invalid login'
|
135
|
+
end
|
136
|
+
|
137
|
+
Steps 'User provides wrong password' do
|
138
|
+
include_steps 'login', 'jack@example.com', 'bla'
|
139
|
+
include_steps 'invalid login'
|
140
|
+
end
|
141
|
+
```
|
122
142
|
|
123
143
|
### Pending steps
|
124
144
|
|
125
145
|
Simular to Example :pending behavior:
|
126
146
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
147
|
+
```ruby
|
148
|
+
Steps 'User login' do
|
149
|
+
# just skip block
|
150
|
+
When 'I go to login'
|
151
|
+
|
152
|
+
# pass pending: true option
|
153
|
+
Then 'I should see welcome', pending: true do
|
154
|
+
...
|
155
|
+
end
|
156
|
+
|
157
|
+
# pass pending: 'some pending message'
|
158
|
+
Then 'I should see last login IP', pending: 'WIP' do
|
159
|
+
...
|
160
|
+
end
|
161
|
+
end
|
162
|
+
```
|
141
163
|
|
142
164
|
## Authors
|
143
165
|
|
@@ -27,7 +27,7 @@ module RSpec
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def example_passed_with_steps(notification)
|
30
|
-
example_passed_without_steps(notification
|
30
|
+
example_passed_without_steps(notification) unless notification.example.metadata[:with_steps]
|
31
31
|
end
|
32
32
|
|
33
33
|
def example_step_passed(notification)
|
data/rspec-example_steps.gemspec
CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'rspec-example_steps'
|
6
|
-
s.version = '3.0.
|
6
|
+
s.version = '3.0.2'
|
7
7
|
s.authors = ['Andriy Yanko']
|
8
8
|
s.email = ['andriy.yanko@gmail.com']
|
9
9
|
s.homepage = 'https://github.com/railsware/rspec-example_steps'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Usual example' do
|
4
|
+
subject { 2 + 2 }
|
5
|
+
|
6
|
+
context 'success' do
|
7
|
+
specify { expect(subject).to eq(4) }
|
8
|
+
end
|
9
|
+
|
10
|
+
context 'failed' do
|
11
|
+
specify { expect(subject).to eq(5) }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'pending' do
|
15
|
+
it 'should be pending'
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rspec-example_steps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andriy Yanko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec-core
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/rspec/example_steps/world.rb
|
46
46
|
- rspec-example_steps.gemspec
|
47
47
|
- spec/example_steps_spec.rb
|
48
|
+
- spec/regression_spec.rb
|
48
49
|
- spec/shared_steps_spec.rb
|
49
50
|
- spec/spec_helper.rb
|
50
51
|
homepage: https://github.com/railsware/rspec-example_steps
|
@@ -73,5 +74,6 @@ specification_version: 4
|
|
73
74
|
summary: Given/When/Then steps for RSpec examples
|
74
75
|
test_files:
|
75
76
|
- spec/example_steps_spec.rb
|
77
|
+
- spec/regression_spec.rb
|
76
78
|
- spec/shared_steps_spec.rb
|
77
79
|
- spec/spec_helper.rb
|