sequel_transaction 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3a6564ae557f5c934bd0243367f8f14b75167871
4
- data.tar.gz: 4690ced67caa966276bf977dc1b9a8a8adfda5ed
3
+ metadata.gz: ff983e9d8e7068c58985400718f8b5ab986fcbd8
4
+ data.tar.gz: 6d7051303b5c2f1b39d5fb85bfe68d32f3566f37
5
5
  SHA512:
6
- metadata.gz: ce76146f852a7370306a9534f82d561c6f837562799a3eb2ba3ea631aabe225ab9e2986557c4776b280e3a5a5ed5747fde7c2ddd3077b84e3a929a75ef890bed
7
- data.tar.gz: fb9b1e64c07fdca63d8aaf90260079afb23a55069e93e33924694b9de6134db5882a286cd3f21dabb6cd45ecf0b5c769fb02eea9ab9d827b0df834cc1adefc40
6
+ metadata.gz: c4a6d137052e29ce7bff66d62977b29790f462001b9464488da1f97c0833963783aae9c3b51fe95cdf90a43830e0698b0237f71312561b3a21c3a4d162698e18
7
+ data.tar.gz: c073bf501e43f246f6d6d74f075fd4ed6dd4154fbb4dbdf2c587f895c9e4cc164f1bd5ff14cd6c89d13e7f7f1452388539229df3c2261cff02777b48f3f0ac07
@@ -8,7 +8,7 @@ module Rack
8
8
  def call(env)
9
9
  req = Request.new env
10
10
  if req.get? || req.head? || req.options?
11
- @inner.call env
11
+ result = @inner.call env
12
12
  else
13
13
  @connection.transaction do
14
14
  result = @inner.call env
@@ -18,9 +18,9 @@ module Rack
18
18
  if err || response.client_error? || response.server_error?
19
19
  raise Sequel::Rollback
20
20
  end
21
- result
22
21
  end
23
22
  end
23
+ result
24
24
  end
25
25
  end
26
26
  end
@@ -1,3 +1,3 @@
1
1
  module SequelTransaction
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -26,40 +26,39 @@ describe Rack::SequelTransaction do
26
26
  end
27
27
  end
28
28
 
29
- it 'returns result' do
30
- expect_call 200
31
- result = subject.call(env)
32
- result.must_equal [200, {}, []]
33
- end
34
-
35
29
  it 'wont rollback when ok' do
36
30
  expect_call 200
37
- subject.call env
31
+ result = subject.call env
32
+ result.must_equal [200, {}, []]
38
33
  dataset.wont_be :empty?
39
34
  end
40
35
 
41
36
  it 'wont roll back on redirect' do
42
37
  expect_call 301
43
- subject.call env
38
+ result = subject.call env
39
+ result.must_equal [301, {}, []]
44
40
  dataset.wont_be :empty?
45
41
  end
46
42
 
47
43
  it 'rolls back on sinatra error' do
48
44
  expect_call 200
49
45
  env['sinatra.error'] = StandardError.new 'snap'
50
- subject.call env
46
+ result = subject.call env
47
+ result.must_equal [200, {}, []]
51
48
  dataset.must_be :empty?
52
49
  end
53
50
 
54
51
  it 'rolls back on server error' do
55
52
  expect_call 500
56
- subject.call env
53
+ result = subject.call env
54
+ result.must_equal [500, {}, []]
57
55
  dataset.must_be :empty?
58
56
  end
59
57
 
60
58
  it 'rolls back on client error' do
61
59
  expect_call 400
62
- subject.call env
60
+ result = subject.call env
61
+ result.must_equal [400, {}, []]
63
62
  dataset.must_be :empty?
64
63
  end
65
64
 
@@ -69,12 +68,6 @@ describe Rack::SequelTransaction do
69
68
  describe "on #{method} request" do
70
69
  before { env['REQUEST_METHOD'] = method }
71
70
 
72
- it 'returns result' do
73
- expect_call 200
74
- result = subject.call(env)
75
- result.must_equal [200, {}, []]
76
- end
77
-
78
71
  it 'wont rollback on sinatra error' do
79
72
  expect_call 200
80
73
  env['sinatra.error'] = StandardError.new 'snap'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sequel_transaction
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vyrak.bunleang@gmail.com