roqua-support 0.1.10 → 0.1.11

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: 548055897fac03f26d5dddd82f144fa64d34d813
4
- data.tar.gz: f497700a4fffb165d1b8b9a8d5ddc486bd77c841
3
+ metadata.gz: c0d83dcfdd5a8666dbfa15efa42dc41bc1286944
4
+ data.tar.gz: f4c169d8f8b96e4b578e4808c7212b0cb2ee1495
5
5
  SHA512:
6
- metadata.gz: c8936bf834d18d7799e200de067c5739132b617c1aaf9e5cfe5fb44d2734ea277abad62ee3d7ecf7a60df0429b803919c757c1e9191fc8fcb02fe7726570b831
7
- data.tar.gz: 6040338582c978cd5b0b00ff7d3bffdf728862c3551af1d7d517f579e57d3edb515d813c41ac9cab8b3acbb9c9247386d9514d1638b3599643b5394c1b991609
6
+ metadata.gz: a11b436cc2a870c201ec997a5e23f6d47148b54d9ce5978fc08b5ef248db4382de8e2d2c9b440085249b3b978123bb6bb21d7db3b41995f93d2a9777c0687069
7
+ data.tar.gz: 5de99e2f313f6c21e70f938db3d79ad0533dc025006cc8f57d6e8d69adb18a4ffd1917bb2adbf97cd3fb53137ac188df88c8d01126ed81201ed3fa51196bdce4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.11 / 2014-11-06
2
+
3
+ * Don't catch Mysql2 errors
4
+
1
5
  ## 0.1.10 / 2014-10-30
2
6
 
3
7
  * Added ActiveInteractionAwareResponder
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- roqua-support (0.1.9)
4
+ roqua-support (0.1.11)
5
5
  activesupport (>= 3.2, < 5.0)
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  module Roqua
2
2
  module Support
3
- VERSION = "0.1.10"
3
+ VERSION = '0.1.11'
4
4
  end
5
5
  end
@@ -9,12 +9,6 @@ module ActiveRecord
9
9
  # containing the validation errors is returned instead.
10
10
  def self.uniq_find_or_create_by(attributes, &block)
11
11
  find_or_create_by(attributes, &block)
12
- # When a real race condition occurs, activerecord has no clue about a uniqueness constraint
13
- # being violated (this is exactly why validates :attribute, uniqueness: true does not work
14
- # for these cases) and a plain Mysql2::Error exception is raised instead of
15
- # ActiveRecord::RecordNotUnique
16
- rescue Mysql2::Error => exception
17
- find_by(attributes) || raise(exception)
18
12
  rescue ActiveRecord::RecordNotUnique => exception
19
13
  find_by(attributes) || raise(exception)
20
14
  end
@@ -23,12 +17,6 @@ module ActiveRecord
23
17
  # error other than uniqueness.
24
18
  def self.uniq_find_or_create_by!(attributes, &block)
25
19
  find_or_create_by!(attributes, &block)
26
- # When a real race condition occurs, activerecord has no clue about a uniqueness constraint
27
- # being violated (this is exactly why validates :attribute, uniqueness: true does not work
28
- # for these cases) and a plain Mysql2::Error exception is raised instead of
29
- # ActiveRecord::RecordNotUnique
30
- rescue Mysql2::Error => exception
31
- find_by(attributes) || raise(exception)
32
20
  rescue ActiveRecord::RecordNotUnique => exception
33
21
  find_by(attributes) || raise(exception)
34
22
  rescue ActiveRecord::RecordInvalid => exception
@@ -13,11 +13,6 @@ module ActiveRecord
13
13
  end
14
14
  end
15
15
 
16
- module Mysql2
17
- class Error < StandardError
18
- end
19
- end
20
-
21
16
  describe ActiveRecord::Base do
22
17
  let(:attributes) { double('attributes') }
23
18
  let(:block) { -> (*args){} }
@@ -41,13 +36,6 @@ describe ActiveRecord::Base do
41
36
  expect(ActiveRecord::Base.uniq_find_or_create_by attributes, &block).to eq(record)
42
37
  end
43
38
 
44
- it 'returns a concurrenlty created record when activerecord is unaware of the uniqueness violation' do
45
- allow(ActiveRecord::Base).to receive(:find_by).with(attributes).and_return record
46
- allow(ActiveRecord::Base).to receive(:find_or_create_by).with(attributes, &block)
47
- .and_raise Mysql2::Error
48
- expect(ActiveRecord::Base.uniq_find_or_create_by attributes, &block).to eq(record)
49
- end
50
-
51
39
  it 'raises when a concurrent record is detected by the database but could not be queried for unknown reasons' do
52
40
  allow(ActiveRecord::Base).to receive(:find_by).with(attributes).and_return nil
53
41
  allow(ActiveRecord::Base).to receive(:find_or_create_by).with(attributes, &block)
@@ -82,13 +70,6 @@ describe ActiveRecord::Base do
82
70
  expect(ActiveRecord::Base.uniq_find_or_create_by! attributes, &block).to eq(record)
83
71
  end
84
72
 
85
- it 'returns a concurrenlty created record when activerecord is unaware of the uniqueness violation' do
86
- allow(ActiveRecord::Base).to receive(:find_by).with(attributes).and_return record
87
- allow(ActiveRecord::Base).to receive(:find_or_create_by!).with(attributes, &block)
88
- .and_raise Mysql2::Error
89
- expect(ActiveRecord::Base.uniq_find_or_create_by! attributes, &block).to eq(record)
90
- end
91
-
92
73
  it 'raises when a concurrent record is detected by the database but could not be queried for unknown reasons' do
93
74
  allow(ActiveRecord::Base).to receive(:find_by).with(attributes).and_return nil
94
75
  allow(ActiveRecord::Base).to receive(:find_or_create_by!).with(attributes, &block)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roqua-support
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marten Veldthuis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-30 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -143,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.3.0
146
+ rubygems_version: 2.2.2
147
147
  signing_key:
148
148
  specification_version: 4
149
149
  summary: Helper objects and proxies used by a lot of RoQua applications
@@ -160,4 +160,3 @@ test_files:
160
160
  - spec/roqua/support/request_logger_spec.rb
161
161
  - spec/roqua/support_spec.rb
162
162
  - spec/spec_helper.rb
163
- has_rdoc: