allowed 0.1.3 → 0.1.4

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: 36c2b249f68b6401263e3a95905cc860612b8c07
4
- data.tar.gz: 108521318be58d7dd97d13de445785203079df10
3
+ metadata.gz: 7af153f66450cb6df34f81701dc3cd967bdc51c4
4
+ data.tar.gz: 2b0899d05b5a3dfa6d3166631eab8299548aaca3
5
5
  SHA512:
6
- metadata.gz: 624d7d2118f76e3527103a407733f9d9ead41e39ce9097e6c69e6cefdf83579b8b098e74b462dbb0cabe6cdf70dd188f7271b6c33b4af2ad83f27c1cf33f62a1
7
- data.tar.gz: aa0bc2b91837b8d703a5cb1b1a03e65c2bfb3d3724b6f938a195d7edbe719c41b9e2c4e52ecd4a7e7b94b9e30e858efb4d50d835cdffada097278cec769d4227
6
+ metadata.gz: 3b33a0f054d66a70805b00e562a4784048089cdba366e5b9e5c78af2c82aa40550cb477ae99a49f8c82f98a655b6082de375b569a9b3aa3433c5ec4476d381a3
7
+ data.tar.gz: d8dd767fa5548e1fccad3f5f9c629ec63923c8ce399e673318dcda48002a3280c45c04665f71f78222713fc019fa7079e1767b75dbdf050957a07b9e508c5930
data/lib/allowed/limit.rb CHANGED
@@ -18,6 +18,7 @@ module Allowed
18
18
  validate :validate_throttles, on: :create
19
19
 
20
20
  after_rollback :handle_throttles, on: :create
21
+ after_validation :handle_throttles, on: :create
21
22
  end
22
23
  end
23
24
 
@@ -36,6 +36,7 @@ describe Allowed::Limit, "#allow" do
36
36
  it "only calls validation callback on create" do
37
37
  instance = subject.new
38
38
  instance.stubs(:validate_throttles)
39
+ instance.stubs(:handle_throttles)
39
40
 
40
41
  instance.save
41
42
  instance.save
@@ -48,6 +49,12 @@ describe Allowed::Limit, "#allow" do
48
49
 
49
50
  expect(subject).to have_callback(:rollback, :handle_throttles, kind: :after, on: :create)
50
51
  end
52
+
53
+ it "adds after validation callback" do
54
+ subject.allow(limit, options)
55
+
56
+ expect(subject).to have_callback(:validation, :handle_throttles, kind: :after, on: :create)
57
+ end
51
58
  end
52
59
 
53
60
  describe Allowed::Limit, "#handle_throttles" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: allowed
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
  - Tristan Dunn
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-02 00:00:00.000000000 Z
11
+ date: 2014-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.3.0
147
+ rubygems_version: 2.2.2
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: Throttling of ActiveRecord model creations.