active_mocker 1.7.2 → 1.7.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/active_mocker/db_to_ruby_type.rb +2 -0
- data/lib/active_mocker/mock/queries.rb +4 -1
- data/lib/active_mocker/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0c73656be49d155784e88ad0bdef8cf2440cc22
|
4
|
+
data.tar.gz: 9a8c27c4c39255bb523bd30fe0ae377f2069143e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6991147d32ce7ed27729922506adaa0930b320ecd2c763bedcf096363e7cace498b38a5d91c1467593b18a6a97ec31fa692a33b1f790ab28e863c5a24519674e
|
7
|
+
data.tar.gz: 726e67dc6b993de80f1dd8fd34135f4c0ae61bc5933155887df8a1e2c9c758aaecb6e084ce004839cdad6480f53a82428fe2464131ae8626d1ab5323cd62332c
|
data/CHANGELOG.md
CHANGED
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.
|
@@ -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
|
-
|
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
|
|
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.
|
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-
|
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.
|
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.
|
124
|
+
version: '10.4'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|