active_mocker 1.7.2 → 1.7.3

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: 70b459ba8b9483e0ad60206fbdc59bcabb9d53b1
4
- data.tar.gz: c1477e53e36c6d5897864788adcade51e62016a4
3
+ metadata.gz: a0c73656be49d155784e88ad0bdef8cf2440cc22
4
+ data.tar.gz: 9a8c27c4c39255bb523bd30fe0ae377f2069143e
5
5
  SHA512:
6
- metadata.gz: bfb38756e480aa1ef4daa7f0e3891949837ae1a659b98a76dd9dbae3862066610071118781e24e4f36d3a138a6e42990e727e23a0735ced9460f171debba9c36
7
- data.tar.gz: f43a9a48f74cec85c015727c1108fc765d92dec0b1ed27b694cce7a2b87dca37eec962018560564024bbbb0ba0bede939a1cbbbc3780823c154641b4b623575b
6
+ metadata.gz: 6991147d32ce7ed27729922506adaa0930b320ecd2c763bedcf096363e7cace498b38a5d91c1467593b18a6a97ec31fa692a33b1f790ab28e863c5a24519674e
7
+ data.tar.gz: 726e67dc6b993de80f1dd8fd34135f4c0ae61bc5933155887df8a1e2c9c758aaecb6e084ce004839cdad6480f53a82428fe2464131ae8626d1ab5323cd62332c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
+ ## 1.7.3 - 2014-12-01
4
+
5
+ ### Fix
6
+ - Passing nil to `find` should of raised an error.
3
7
 
4
8
  ## 1.7.2 - 2014-10-27
5
9
 
data/README.md CHANGED
@@ -357,6 +357,8 @@ See [Documentation](http://rdoc.info/github/zeisler/active_mocker/master/ActiveM
357
357
  * When an association is set in one object it may not always be reflective in other objects, especially when it is a non standard/custom association. See [test_rails_4_app/spec/active_record_compatible_api.rb](https://github.com/zeisler/active_mocker/blob/master/test_rails_4_app/spec/active_record_compatible_api.rb) for a complete list of supported associations.
358
358
  * Validation/Callbacks are not supported.
359
359
  * Sql queries, joins, etc will never be supported.
360
+ * A record that has been created and then is modified will persist changes without calling `#save`, beware of this difference.
361
+ * This is not a full replacement for ActiveRecord. It has been simplified, having only the most essential parts, so that the is code easier to maintain. I have done my best to make it work correctly, but it is up to you to know how ActiveRecord works and know it's limitations. I aim to make the code easy to read so that it can be understood and modified by it's users.
360
362
 
361
363
  ## Inspiration
362
364
  Thanks to Jeff Olfert for being my original inspiration for this project.
@@ -20,6 +20,8 @@ module ActiveMocker
20
20
  String
21
21
  when :boolean
22
22
  Axiom::Types::Boolean
23
+ when :hstore
24
+ Hash
23
25
  end
24
26
  end
25
27
 
@@ -120,6 +120,7 @@ module Mock
120
120
  #
121
121
  # <tt>ActiveMocker::Mock::RecordNotFound</tt> will be raised if one or more ids are not found.
122
122
  def find(ids)
123
+ raise RecordNotFound.new("Couldn't find #{self.name} without an ID") if ids.nil?
123
124
  results = [*ids].map do |id|
124
125
  find_by!(id: id.to_i)
125
126
  end
@@ -188,7 +189,9 @@ module Mock
188
189
  # an <tt>ActiveRecord::RecordNotFound</tt> error.
189
190
  def find_by!(conditions={})
190
191
  result = find_by(conditions)
191
- raise RecordNotFound if result.nil?
192
+ if result.nil?
193
+ raise RecordNotFound.new("Couldn't find #{self.name} with '#{conditions.keys.first}'=#{conditions.values.first}")
194
+ end
192
195
  result
193
196
  end
194
197
 
@@ -1,3 +1,3 @@
1
1
  module ActiveMocker
2
- VERSION = "1.7.2"
2
+ VERSION = "1.7.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_mocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dustin Zeisler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '10.1'
117
+ version: '10.4'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: '10.1'
124
+ version: '10.4'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: rspec
127
127
  requirement: !ruby/object:Gem::Requirement