factory_girl_remote_strategy 0.0.2 → 0.0.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b12a6ff082498a3f4e83c7cc810f9cfa3f725395
|
4
|
+
data.tar.gz: 3d0ea0fca67e0f3d6d3243a51b3251a57c2c2c5c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8399c43b48a4fd3faff3f101c740bcfaa25fa66012c8a5b7ec451a8161acec1bf6ad79acc4a5fdf8f5b8f100bba0550d39e634d8c1f313c7e7115901837c6bb8
|
7
|
+
data.tar.gz: 9f200c110a747549fb447cee1e2bd5fb2686765d961ee437d8e422715e1ba9be7c3c0307efcda45c2aa7d93138863249f776e491786290561e77b50f25dfd8ed
|
@@ -59,7 +59,7 @@ module FactoryGirl
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def collection_url(collection)
|
62
|
-
collection.first.class.instance_eval { "#{site}#{prefix}#{collection_name}.json" }
|
62
|
+
(collection.first.is_a?(Class) ? collection.first : collection.first.class).instance_eval { "#{site}#{prefix}#{collection_name}.json" }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -74,5 +74,5 @@ def remote_search(*args)
|
|
74
74
|
params = args.extract_options!
|
75
75
|
collection = args.flatten
|
76
76
|
FakeWeb.register_uri(:get, "#{FactoryGirl::RemoteStrategy.collection_url(collection)}?#{params.to_query}",
|
77
|
-
body: collection.map { |e| FactoryGirl::RemoteStrategy.entity_hash(e) }.to_json)
|
77
|
+
body: (collection.first.is_a?(Class) ? "[]" : collection.map { |e| FactoryGirl::RemoteStrategy.entity_hash(e) }.to_json))
|
78
78
|
end
|
@@ -63,5 +63,12 @@ describe FactoryGirl::RemoteStrategy do
|
|
63
63
|
memberships.should be_kind_of Array
|
64
64
|
memberships.first.should be_kind_of Membership
|
65
65
|
end
|
66
|
+
|
67
|
+
it "registers search url of empty collection if provided model class (no first element)" do
|
68
|
+
remote_search Membership, search: { premises_id_in: [4] }
|
69
|
+
expect { Membership.find(:all, params: { search: { premises_id_in: [4] } }) }.not_to raise_error
|
70
|
+
memberships = Membership.find(:all, params: { search: { premises_id_in: [4] } })
|
71
|
+
memberships.should eq []
|
72
|
+
end
|
66
73
|
end
|
67
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factory_girl_remote_strategy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Avoyants
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|