trailblazer-finder 0.10.1 → 0.10.2
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d90691d88aed4c8d7e43ccd1fd4160ed6f445b7915becf4c76bd025ca4d0f661
|
4
|
+
data.tar.gz: e66c8f81873325b16f81e2d4ae9b99111f16a704c54d01de24bcac27bdb1d479
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2af6f7a7e82d96a8385d23d88702501881eee63ee2a23e0308a4a2a4eaca9c217721df62479088f03716a1adc3e790f18b32fb26de76685b1e6aef4459d3fe8
|
7
|
+
data.tar.gz: 7f44b76f696ce6788584c7a97f703e5e4b4e4ced2a39fded2f672ad3468623f3e161a868bfc6861cdf1d4d5117f1eb57f28ebe0816fae8f78a48b1a7b75c2604
|
data/CHANGES.md
CHANGED
@@ -17,7 +17,8 @@ module Trailblazer
|
|
17
17
|
def process_filters(ctx)
|
18
18
|
@params.reduce(@entity) do |entity, (name, value)|
|
19
19
|
value = Utils::String.to_date(value) if Utils::String.date?(value)
|
20
|
-
|
20
|
+
filter = @filters[name.to_sym] || @filters[name]
|
21
|
+
new_entity = ctx.instance_exec entity, filter[:name], value, &filter[:handler]
|
21
22
|
new_entity || entity
|
22
23
|
end
|
23
24
|
end
|
@@ -69,6 +69,14 @@ describe "Trailblazer::Operation - Finder Macro" do
|
|
69
69
|
expect(result[:finder].name).to eq "product_4"
|
70
70
|
end
|
71
71
|
|
72
|
+
it "Can find a single row by id from ActiveSupport::HashWithIndifferentAccess" do
|
73
|
+
params = ActiveSupport::HashWithIndifferentAccess.new({id: 6})
|
74
|
+
result = Product::Show.call(params: params)
|
75
|
+
|
76
|
+
expect(result[:finder].name).to eq "product_5"
|
77
|
+
end
|
78
|
+
|
79
|
+
|
72
80
|
it "Can find a single row by name" do
|
73
81
|
params = {name_eq: "product_2"}
|
74
82
|
result = Product::Show.call(params: params)
|