cross_spec_rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/cross_spec_rails/factories_controller.rb +14 -2
- data/config/routes.rb +1 -0
- data/lib/cross_spec_rails/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b93b514b34ca1af477833e1f9fe983dd8528a9e
|
4
|
+
data.tar.gz: 015ab1c9cbba62a9cc38f10c8e6b5b8be9807336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a057ab56945708e17eaf1f1117d499d7fe3c6f490d8ea95046b211ad6b84fb945d1b74c871b9e4bab2213a00261d2c656eb782a4e6093338e38d62e2af1ebd0d
|
7
|
+
data.tar.gz: c9ea2a3db62fd998844b263984b66cd7d79f8ed70ad838f49166d7fe2a6bca079c142cfaa5ae1e8d4443c7add77b20524c6b47fb3e0986f3e066ed88b9d530b9
|
@@ -19,8 +19,20 @@ module CrossSpecRails
|
|
19
19
|
def create
|
20
20
|
factory = params[:factory]
|
21
21
|
traits = Array(params[:traits])
|
22
|
-
attributes = params
|
23
|
-
|
22
|
+
attributes = params[:attributes]&.permit!.to_h
|
23
|
+
includes = params[:includes]
|
24
|
+
instance = factory_klass.create(factory, *traits, attributes)
|
25
|
+
render json: instance.to_json(params[:to_json_args])
|
26
|
+
end
|
27
|
+
|
28
|
+
def create_list
|
29
|
+
factory = params[:factory]
|
30
|
+
traits = Array(params[:traits])
|
31
|
+
attributes = params[:attributes]&.permit!.to_h
|
32
|
+
includes = params[:includes]
|
33
|
+
num = params[:num].to_i
|
34
|
+
instances = factory_klass.create_list(factory, num, *traits, attributes)
|
35
|
+
render json: instance.map { |instance| instance.to_json(params[:to_json_args]) }
|
24
36
|
end
|
25
37
|
|
26
38
|
private
|
data/config/routes.rb
CHANGED