rspec-example_steps 3.0.1 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd97af8e8b76d12ec7434c4eb854aa651555c42c
4
- data.tar.gz: e4449872a1ec8ae034d9136682f52f4594d71d40
3
+ metadata.gz: 489096c9a1854033941f9011671224109ba01512
4
+ data.tar.gz: 3e60360c4d30279ed99788e14155957ffb9c90ca
5
5
  SHA512:
6
- metadata.gz: 777bc5d0fc4d8ce11f571cf9bb1735e8f3bd3344409080073f4a3678481304d1ac6a8a7b284ceadc7c35cc17b5342731a4e11a7cee9273506a61cc0e45f42b88
7
- data.tar.gz: 3a76f6f840f06048ee69def67e3a2d2003ce06afc43bbb3c07145f592f4904a6e0f4fd84ee045014b77f3cac1ca13222823e1c400a223edf8602c8138fe9d4fb
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 rspec2
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
- <pre>
11
- gem 'rspec-example_steps'
12
- </pre>
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
- require 'rspec/example_steps'
29
+ `spec/features/search_spec.rb`
17
30
 
18
- context "Searching" do
19
- Steps "Result found" do
20
- Given "I am on search page" do
21
- page.visit("/search")
22
- page.should have_content("Search")
23
- end
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
- When "I search something" do
26
- page.fill_in('Search', :with => 'John')
27
- page.click_button "Go"
28
- end
39
+ When 'I search something' do
40
+ fill_in 'Search', with: 'John'
41
+ click_button 'Go'
42
+ end
29
43
 
30
- Then "I should see result" do
31
- page.should have_content("Result")
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
- Searching
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
- shared_steps "login" do
54
- When "I go to login page" do
55
- page.visit '/login'
56
- end
57
- When "I put credentials" do
58
- page.fill_in 'Login', :with => 'jack@example.com'
59
- page.fill_in 'Password', :with => 'password''
60
- end
61
- Then "I should be logged in" do
62
- page.status_code.should == 200
63
- page.should have_content("Welcome jack@example.com")
64
- end
65
- end
66
-
67
- shared_steps "logout" do
68
- page.visit '/logout'
69
- page.status_code.should == 200
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
- context "user flow"
73
- Steps "User updates profile description" do
74
- include_steps "login"
75
- When "I update profile description" do
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
- shared_steps "login" do |email, password|
97
- When "I go to login page" do
98
- page.visit '/login'
99
- end
100
- When "I put credentials" do
101
- page.fill_in 'Login', :with => email
102
- page.fill_in 'Password', :with => password
103
- end
104
- end
105
-
106
- shared_steps "invalid login" do
107
- Then "I should see login error" do
108
- ...
109
- end
110
- end
111
-
112
- Steps "User provides wrong email" do
113
- include_steps "login", 'jack', 'qwerty'
114
- include_steps "invalid login"
115
- end
116
-
117
- Steps "User provides wrong password" do
118
- include_steps "login", 'jack@example.com', 'bla'
119
- include_steps "invalid login"
120
- end
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
- Steps "User login" do
128
- # just skip block
129
- When "I go to login"
130
-
131
- # pass :pending => true option
132
- Then "I should see welcome", :pending => true do
133
- ...
134
- end
135
-
136
- # pass :pending => "some pending message"
137
- Then "I should see last login IP", :pending => "WIP" do
138
- ...
139
- end
140
- end
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.example) unless notification.example.metadata[:with_steps]
30
+ example_passed_without_steps(notification) unless notification.example.metadata[:with_steps]
31
31
  end
32
32
 
33
33
  def example_step_passed(notification)
@@ -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.1'
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.1
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-15 00:00:00.000000000 Z
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