nakajima-fixjour 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/fixjour/verify.rb +15 -11
  2. metadata +1 -1
@@ -21,18 +21,22 @@ module Fixjour
21
21
  error(klass, WrongBuilderType, "must return an instance of #{klass}")
22
22
  end
23
23
 
24
- begin
25
- result.save!
26
- rescue => e
27
- error(klass, UnsavableBuilder, "raises #{e.inspect} when saved to the database")
28
- end
24
+ klass.transaction do
25
+ begin
26
+ result.save!
27
+ rescue => e
28
+ error(klass, UnsavableBuilder, "raises #{e.inspect} when saved to the database")
29
+ end
29
30
 
30
- unless new_record(klass).valid?
31
- msg = ""
32
- msg << "returns invalid an invalid object after another object has been saved.\n"
33
- msg << "This could be caused by a validates_uniqueness_of validation in your model.\n"
34
- msg << "Use something like the faker gem to alleviate this issue."
35
- error(klass, DangerousBuilder, msg)
31
+ unless new_record(klass).valid?
32
+ msg = ""
33
+ msg << "returns invalid an invalid object after another object has been saved.\n"
34
+ msg << "This could be caused by a validates_uniqueness_of validation in your model.\n"
35
+ msg << "Use something like the faker gem to alleviate this issue."
36
+ error(klass, DangerousBuilder, msg)
37
+ end
38
+
39
+ raise ActiveRecord::Rollback
36
40
  end
37
41
  end
38
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nakajima-fixjour
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pat Nakajima