has_token_id 0.4.2 → 0.4.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: ee4ece1e713f29cebb06cbf0adcf72442e33b286
4
- data.tar.gz: 18919caf99be5cbe289e4db5b9b24a0bbe05dbb6
3
+ metadata.gz: 2434c3ca123b2c8cf8d6f8c41e91e16f4675ac52
4
+ data.tar.gz: 84d2fbcd1af6be0913ead86d16cd8b91ce5494f4
5
5
  SHA512:
6
- metadata.gz: 6d6f647494b39d8defdc179f02339c38dd2f85c5672ac547199b7c2c1354b5d13d3423260767cc8b9b0421647df5a94a5b098bbb036c39ba58a1f2e0acfcf923
7
- data.tar.gz: 2cdfbe07ee7a237aec3111d115983b3711c7ca05bc95a44d4f7e5bf0c9d40297a72c9b289c57b8c006f5214c35196cccb60fdef45b215f01d1b4ced7b8ba6094
6
+ metadata.gz: 386d303806fc383c46d3a187eb2bd47af5ebdc37e85d4ebd5ccd6cee1303f70c293e015323fcd9475f84ed07542bc764f2722f00ca62cd731ae47970c81046d5
7
+ data.tar.gz: 7cdf6aae79b897a4ace1cf90460dda57f3235740f75f402ce1830149a112014275af72d2952052ee35fc8f6d88c9ae293a7f3be62df8c19b1c18e6cd662bc34d
data/.travis.yml CHANGED
@@ -8,4 +8,3 @@ rvm:
8
8
  - 2.2.3
9
9
  - 2.3.1
10
10
  - rbx
11
- - ree
@@ -34,6 +34,12 @@ module HasTokenId
34
34
  record || super(*args)
35
35
  end
36
36
 
37
+ def find!(*args)
38
+ record = find(*args)
39
+ raise ActiveRecord::RecordNotFound if record.nil?
40
+ record
41
+ end
42
+
37
43
  private
38
44
 
39
45
  def token_with_table_name
@@ -1,3 +1,3 @@
1
1
  module HasTokenId
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
@@ -97,4 +97,19 @@ class FinderMethodsTest < MiniTest::Should::TestCase
97
97
  end
98
98
 
99
99
  end
100
+
101
+ context "#find!" do
102
+
103
+ should "find record" do
104
+ assert_equal @item, Item.find!(@item.id)
105
+ end
106
+
107
+ should "raise active record not found when record is nil" do
108
+ assert_raises ActiveRecord::RecordNotFound do
109
+ Item.find!("test")
110
+ end
111
+ end
112
+
113
+ end
114
+
100
115
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_token_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spencer Steffen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord