flunk 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/flunk.rb +3 -3
- data/test/integration/bananas_test.rb +8 -3
- metadata +2 -2
data/lib/flunk.rb
CHANGED
@@ -5,9 +5,8 @@ class Flunk < ActionDispatch::IntegrationTest
|
|
5
5
|
def self.test(resource, action, &block)
|
6
6
|
new_proc = Proc.new do
|
7
7
|
instance_eval(&block)
|
8
|
-
@before.call unless @before.nil?
|
9
8
|
result
|
10
|
-
|
9
|
+
instance_eval(&@after) unless @after.nil?
|
11
10
|
end
|
12
11
|
|
13
12
|
if !action || !resource
|
@@ -38,7 +37,7 @@ class Flunk < ActionDispatch::IntegrationTest
|
|
38
37
|
|
39
38
|
assert_response @status, @response.body
|
40
39
|
|
41
|
-
|
40
|
+
unless response.body.blank?
|
42
41
|
if response.content_type == 'application/json'
|
43
42
|
json = ActiveSupport::JSON.decode(response.body)
|
44
43
|
rec_symbolize( json )
|
@@ -94,6 +93,7 @@ class Flunk < ActionDispatch::IntegrationTest
|
|
94
93
|
|
95
94
|
def before(&block)
|
96
95
|
@before = block
|
96
|
+
instance_eval(&@before)
|
97
97
|
end
|
98
98
|
|
99
99
|
def after(&block)
|
@@ -8,15 +8,20 @@ class BananasTest < Flunk
|
|
8
8
|
|
9
9
|
# Write tests that should succeed to make sure the required functionality works.
|
10
10
|
test "Banana", "Create" do
|
11
|
+
before {
|
12
|
+
@count = 1
|
13
|
+
p "before was called"
|
14
|
+
}
|
15
|
+
|
16
|
+
p @count
|
11
17
|
desc "Create a Banana"
|
12
18
|
path "bananas"
|
13
19
|
method :post
|
14
20
|
status :created
|
15
21
|
body banana: { weight: 2 }
|
16
|
-
|
17
|
-
p "before was called"
|
18
|
-
}
|
22
|
+
|
19
23
|
after {
|
24
|
+
assert_equal @count, 1
|
20
25
|
p "after was called"
|
21
26
|
}
|
22
27
|
end
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: flunk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Adam Kirk
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem for testing Ruby on Rails web APIs by simulating a client.
|
15
15
|
email: atomkirk@gmail.com
|