flunk 0.0.1 → 0.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.
- data/README.md +41 -41
- data/flunk-0.0.1.gem +0 -0
- data/flunk.gemspec +3 -3
- metadata +5 -7
- data/test/test_flunk.rb +0 -6
data/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Flunk
|
|
2
2
|
=====
|
|
3
3
|
|
|
4
|
-
A gem for testing
|
|
4
|
+
A gem for testing Ruby on Rails web APIs by simulating a client.
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
### Installation
|
|
@@ -34,7 +34,7 @@ Once you call `assertions`, the request is fired and a `result` method is availa
|
|
|
34
34
|
It's your typical rails integration test, but inherits from Flunk:
|
|
35
35
|
|
|
36
36
|
class UsersTest < Flunk
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
setup do
|
|
39
39
|
@user = FactoryGirl.create(:user)
|
|
40
40
|
end
|
|
@@ -56,7 +56,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
56
56
|
assert_equal 1, user.languages.count
|
|
57
57
|
}
|
|
58
58
|
end
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
test "Log In" do
|
|
61
61
|
desc "Obtain a users API token by logging in with their username and password"
|
|
62
62
|
path "login"
|
|
@@ -67,7 +67,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
67
67
|
assert_not_nil result[:api_token]
|
|
68
68
|
}
|
|
69
69
|
end
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
test "Log In With Email" do
|
|
72
72
|
path "login"
|
|
73
73
|
method :get
|
|
@@ -77,7 +77,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
77
77
|
assert_not_nil result[:api_token]
|
|
78
78
|
}
|
|
79
79
|
end
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
test "Read User" do
|
|
82
82
|
desc "Read a users information."
|
|
83
83
|
path "account"
|
|
@@ -85,7 +85,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
85
85
|
username @user.api_token
|
|
86
86
|
status :ok
|
|
87
87
|
end
|
|
88
|
-
|
|
88
|
+
|
|
89
89
|
test "Update User" do
|
|
90
90
|
desc "Update the username, e-mail, password and/or name"
|
|
91
91
|
path "account"
|
|
@@ -97,7 +97,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
97
97
|
assert_equal result[:username], username
|
|
98
98
|
}
|
|
99
99
|
end
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
test "Update E-mail" do
|
|
102
102
|
path "account"
|
|
103
103
|
method :put
|
|
@@ -108,7 +108,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
108
108
|
assert_equal result[:email], email
|
|
109
109
|
}
|
|
110
110
|
end
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
test "Update User Password" do
|
|
113
113
|
path "account"
|
|
114
114
|
method :put
|
|
@@ -116,7 +116,7 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
116
116
|
body user: { password: Faker::Lorem.characters(10) }
|
|
117
117
|
status :ok
|
|
118
118
|
end
|
|
119
|
-
|
|
119
|
+
|
|
120
120
|
test "Update Name" do
|
|
121
121
|
path "account"
|
|
122
122
|
method :put
|
|
@@ -127,19 +127,19 @@ You write tests that SHOULD pass to test your app's basic functionality all work
|
|
|
127
127
|
assert_equal result[:name], name
|
|
128
128
|
}
|
|
129
129
|
end
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
test "Delete User" do
|
|
132
132
|
path "account"
|
|
133
133
|
method :delete
|
|
134
134
|
username @user.api_token
|
|
135
135
|
status :ok
|
|
136
136
|
end
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests correctly/gracefully:
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
|
|
143
143
|
flunk "Create User", "Missing username" do
|
|
144
144
|
desc "Attempting to create a user without a username."
|
|
145
145
|
path "signup"
|
|
@@ -147,21 +147,21 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
147
147
|
body user: FactoryGirl.attributes_for(:user, username: nil)
|
|
148
148
|
status :unprocessable_entity
|
|
149
149
|
end
|
|
150
|
-
|
|
150
|
+
|
|
151
151
|
flunk "Create User", "Username already taken" do
|
|
152
152
|
path "signup"
|
|
153
153
|
method :post
|
|
154
154
|
body user: FactoryGirl.attributes_for(:user, username: @user.username)
|
|
155
155
|
status :unprocessable_entity
|
|
156
156
|
end
|
|
157
|
-
|
|
157
|
+
|
|
158
158
|
flunk "Create User", "Invalid username" do
|
|
159
159
|
path "signup"
|
|
160
160
|
method :post
|
|
161
161
|
body user: FactoryGirl.attributes_for(:user, username: "a234$2aa" )
|
|
162
162
|
status :unprocessable_entity
|
|
163
163
|
end
|
|
164
|
-
|
|
164
|
+
|
|
165
165
|
flunk "Create User", "Missing e-mail" do
|
|
166
166
|
desc "Attempting to create a user without a e-mail."
|
|
167
167
|
path "signup"
|
|
@@ -169,7 +169,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
169
169
|
body user: FactoryGirl.attributes_for(:user, email: nil)
|
|
170
170
|
status :unprocessable_entity
|
|
171
171
|
end
|
|
172
|
-
|
|
172
|
+
|
|
173
173
|
flunk "Create User", "E-mail already taken" do
|
|
174
174
|
desc "Attempting to create a user with an e-mail that's already taken."
|
|
175
175
|
path "signup"
|
|
@@ -177,14 +177,14 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
177
177
|
body user: FactoryGirl.attributes_for(:user, email: @user.email)
|
|
178
178
|
status :unprocessable_entity
|
|
179
179
|
end
|
|
180
|
-
|
|
180
|
+
|
|
181
181
|
flunk "Create User", "Invalid e-mail" do
|
|
182
182
|
path "signup"
|
|
183
183
|
method :post
|
|
184
184
|
body user: FactoryGirl.attributes_for(:user, email: "aaaa@aakk")
|
|
185
185
|
status :unprocessable_entity
|
|
186
186
|
end
|
|
187
|
-
|
|
187
|
+
|
|
188
188
|
flunk "Create User", "Missing password" do
|
|
189
189
|
desc "Attempting to create a user without a password."
|
|
190
190
|
path "signup"
|
|
@@ -192,17 +192,17 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
192
192
|
body user: FactoryGirl.attributes_for(:user, password: nil)
|
|
193
193
|
status :unprocessable_entity
|
|
194
194
|
end
|
|
195
|
-
|
|
195
|
+
|
|
196
196
|
flunk "Create User", "Missing name" do
|
|
197
197
|
path "signup"
|
|
198
198
|
method :post
|
|
199
199
|
body user: FactoryGirl.attributes_for(:user, name: nil)
|
|
200
200
|
status :unprocessable_entity
|
|
201
201
|
end
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
206
|
flunk "Log In", "No username" do
|
|
207
207
|
desc "Attempting to obtain an API token with the wrong password"
|
|
208
208
|
path "login"
|
|
@@ -210,7 +210,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
210
210
|
body password: "a"
|
|
211
211
|
status :unauthorized
|
|
212
212
|
end
|
|
213
|
-
|
|
213
|
+
|
|
214
214
|
flunk "Log In", "Wrong password" do
|
|
215
215
|
desc "Attempting to obtain an API token with the wrong password"
|
|
216
216
|
path "login"
|
|
@@ -218,20 +218,20 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
218
218
|
body username: @user.username, password: "a"
|
|
219
219
|
status :unauthorized
|
|
220
220
|
end
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
225
|
flunk "Read User", "Wrong API token" do
|
|
226
226
|
path "login"
|
|
227
227
|
method :get
|
|
228
228
|
username "a"
|
|
229
229
|
status :unauthorized
|
|
230
230
|
end
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
235
|
flunk "Update User", "Wrong password" do
|
|
236
236
|
path "account"
|
|
237
237
|
method :put
|
|
@@ -239,7 +239,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
239
239
|
body user: FactoryGirl.attributes_for(:user)
|
|
240
240
|
status :unauthorized
|
|
241
241
|
end
|
|
242
|
-
|
|
242
|
+
|
|
243
243
|
flunk "Update User", "Username already taken" do
|
|
244
244
|
path "account"
|
|
245
245
|
method :put
|
|
@@ -248,7 +248,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
248
248
|
body user: { username: u.username }
|
|
249
249
|
status :unprocessable_entity
|
|
250
250
|
end
|
|
251
|
-
|
|
251
|
+
|
|
252
252
|
flunk "Update User", "Invalid username" do
|
|
253
253
|
path "account"
|
|
254
254
|
method :put
|
|
@@ -256,7 +256,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
256
256
|
body user: { username: "a234$2aa" }
|
|
257
257
|
status :unprocessable_entity
|
|
258
258
|
end
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
flunk "Update User", "E-mail already taken" do
|
|
261
261
|
desc "Attempting to update a user with an e-mail that's already taken."
|
|
262
262
|
path "account"
|
|
@@ -266,7 +266,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
266
266
|
body user: { email: u.email }
|
|
267
267
|
status :unprocessable_entity
|
|
268
268
|
end
|
|
269
|
-
|
|
269
|
+
|
|
270
270
|
flunk "Update User", "Invalid e-mail" do
|
|
271
271
|
desc "Attempting to update the user with an invalid e-mail"
|
|
272
272
|
path "account"
|
|
@@ -275,10 +275,10 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
275
275
|
body user: { email: "aaaa@aakk" }
|
|
276
276
|
status :unprocessable_entity
|
|
277
277
|
end
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
282
|
flunk "Delete User", "Wrong password" do
|
|
283
283
|
path "account"
|
|
284
284
|
method :delete
|
|
@@ -286,7 +286,7 @@ Then, write tests that SHOULDN'T pass to make sure your app rejects bad requests
|
|
|
286
286
|
body user: FactoryGirl.attributes_for(:user)
|
|
287
287
|
status :unauthorized
|
|
288
288
|
end
|
|
289
|
-
|
|
289
|
+
|
|
290
290
|
end
|
|
291
291
|
|
|
292
292
|
### Generator
|
data/flunk-0.0.1.gem
ADDED
|
Binary file
|
data/flunk.gemspec
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = "flunk"
|
|
3
|
-
s.version = "0.0.
|
|
3
|
+
s.version = "0.0.2"
|
|
4
4
|
s.platform = Gem::Platform::RUBY
|
|
5
5
|
s.authors = ["Adam Kirk"]
|
|
6
6
|
s.email = %q{atomkirk@gmail.com}
|
|
7
7
|
s.homepage = %q{https://github.com/mysterioustrousers/flunk}
|
|
8
|
-
s.summary = %q{A gem for testing
|
|
9
|
-
s.description = %q{A gem for testing
|
|
8
|
+
s.summary = %q{A gem for testing Ruby on Rails web APIs by simulating a client.}
|
|
9
|
+
s.description = %q{A gem for testing Ruby on Rails web APIs by simulating a client.}
|
|
10
10
|
|
|
11
11
|
s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
|
|
12
12
|
s.test_files =`git ls-files -- test/*`.split("\n")
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: flunk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,9 +9,9 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-01-
|
|
12
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
|
13
13
|
dependencies: []
|
|
14
|
-
description: A gem for testing
|
|
14
|
+
description: A gem for testing Ruby on Rails web APIs by simulating a client.
|
|
15
15
|
email: atomkirk@gmail.com
|
|
16
16
|
executables: []
|
|
17
17
|
extensions: []
|
|
@@ -27,7 +27,6 @@ files:
|
|
|
27
27
|
- lib/generators/flunk_test/flunk_test_generator.rb
|
|
28
28
|
- lib/generators/flunk_test/templates/flunk_test.rb
|
|
29
29
|
- lib/tasks/flunk.rake
|
|
30
|
-
- test/test_flunk.rb
|
|
31
30
|
homepage: https://github.com/mysterioustrousers/flunk
|
|
32
31
|
licenses: []
|
|
33
32
|
post_install_message:
|
|
@@ -51,6 +50,5 @@ rubyforge_project:
|
|
|
51
50
|
rubygems_version: 1.8.24
|
|
52
51
|
signing_key:
|
|
53
52
|
specification_version: 3
|
|
54
|
-
summary: A gem for testing
|
|
55
|
-
test_files:
|
|
56
|
-
- test/test_flunk.rb
|
|
53
|
+
summary: A gem for testing Ruby on Rails web APIs by simulating a client.
|
|
54
|
+
test_files: []
|