mock_relation 0.0.1 → 0.0.2
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 +8 -8
- data/README.md +1 -1
- data/lib/mock_relation.rb +18 -0
- data/mock_relation.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZWMyNGQ3MDFhNzAyNjA1MTYyM2QxNGNhZmE0MDc0NTNkNTIyOGM4NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmY4MjlhYzg3ZDBkNzUzMjhhOGNiYTEzY2Y0NGY3ZGYyNzk1ZDQyNg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjA5YWRlZWYzZDYyZWQ2OGYwYmI2ZjBhYjRiZmEyN2E2NWUzYjMwNDY2OWI1
|
10
|
+
MDlmYjViMzQ0YzFmMDcyNmI2MmQwOTlmMmJjNzczMDY4ZWVkNGIzZWUwZThj
|
11
|
+
NmUyZGUyMjA1NDc5NTQ2MDZiNDk4N2YzOWJiNDg3MWE1YWQ5MWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTU0ZTc3MjExNWNlYmM1MGVhY2U1NDkzMTRmNzdlZjRmMWY4OTRmYzliZWIx
|
14
|
+
MGUwNTdjZDkxZDBiYzVhNjliYWVmMTEwYjU4NDlhNDM2NTFmZDI4NmRkNjFi
|
15
|
+
MzRlYTY1MzE1Mjg5Zjk4ZTBiZDU3YTMxMjA1NWVhMjMzMWViNDI=
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A chainable mock object for making assertions about `ActiveRecord::Relation` instances.
|
4
4
|
|
5
|
-
|
5
|
+
[Further reading.](http://www.foraker.com/isolating-and-testing-active-record-dependencies/)
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
data/lib/mock_relation.rb
CHANGED
@@ -14,6 +14,24 @@ class MockRelation < Hash
|
|
14
14
|
fetch(scope, []).include?(args)
|
15
15
|
end
|
16
16
|
|
17
|
+
def includes(*args)
|
18
|
+
self
|
19
|
+
end
|
20
|
+
alias :joins :includes
|
21
|
+
alias :scoped :includes
|
22
|
+
|
23
|
+
def unscoped
|
24
|
+
clone.clear
|
25
|
+
end
|
26
|
+
|
27
|
+
def destroy_all
|
28
|
+
@destroyed = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def destroyed?
|
32
|
+
@destroyed
|
33
|
+
end
|
34
|
+
|
17
35
|
private
|
18
36
|
|
19
37
|
def mocks_scope?(scope)
|
data/mock_relation.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "mock_relation"
|
7
|
-
spec.version = "0.0.
|
7
|
+
spec.version = "0.0.2"
|
8
8
|
spec.authors = ["Ben Eddy"]
|
9
9
|
spec.email = ["bae@foraker.com"]
|
10
10
|
spec.description = %q{A simple mock for instance of ActiveRecord::Relation}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock_relation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eddy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|