render_turbo_stream 0.1.38 → 0.1.40
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/README.md +2 -3
- data/lib/render_turbo_stream/request_test_helpers.rb +10 -40
- data/lib/render_turbo_stream/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1d7e23e79f3d7f68a39cd3b9163020515231012283068dd777ed5544f8ad5db
|
4
|
+
data.tar.gz: 38428bc23917c1c9ea1643381a2034605b5ece0ab69f8768297e2f876e3e6720
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a1f7456bd103ce669d356d8c7abd9af013cd7c38cb25c34d5bd5e3461343ede8ead6f271dfbaec69ef42aaac22f34f481dadac2ce04303cfa8f446ea8bada72
|
7
|
+
data.tar.gz: d247dd8be9882db553478062ba937757e5e657264f4a49eab8d642c363cc54eeeca1933290548503c7c6a0a4f38a75409c596e7c03f152a4d019a7ec5047f527
|
data/README.md
CHANGED
@@ -44,7 +44,7 @@ from [turbo_power](https://github.com/marcoroth/turbo_power).
|
|
44
44
|
Required Configurations for Flash Partial
|
45
45
|
|
46
46
|
```ruby
|
47
|
-
|
47
|
+
config.x.render_turbo_stream.flash_partial = 'layouts/flash'
|
48
48
|
config.x.render_turbo_stream.flash_id = 'flash-box'
|
49
49
|
config.x.render_turbo_stream.flash_action = 'prepend'
|
50
50
|
```
|
@@ -147,10 +147,9 @@ RSpec.describe "Articles", type: :request do
|
|
147
147
|
expect(partials_responses(id: 'flash-box').length).to eq(1)
|
148
148
|
|
149
149
|
# Same with partials
|
150
|
-
|
151
150
|
expect(partials_responses(partial: 'layouts/flash').length).to eq(1)
|
152
151
|
|
153
|
-
#
|
152
|
+
# partials_log: developer information about what the renderer did, and strings to copy and paste into test commands
|
154
153
|
expect(partials_log.join('')).to include('Article could not be created')
|
155
154
|
expect(partials_log.join('')).to include('layouts/flash')
|
156
155
|
|
@@ -29,48 +29,18 @@ module RenderTurboStream
|
|
29
29
|
res.map { |r| Nokogiri::HTML(r['html_response']) }
|
30
30
|
end
|
31
31
|
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
paths_once = []
|
42
|
-
ary.each do |a|
|
43
|
-
if paths.include?(a['partial'])
|
44
|
-
paths_once.delete(a['partial'])
|
45
|
-
else
|
46
|
-
paths.push(a['partial'])
|
47
|
-
paths_once.push(a['partial'])
|
48
|
-
end
|
49
|
-
end
|
50
|
-
if args.present?
|
51
|
-
paths_once
|
52
|
-
if args.length == paths_once.length
|
53
|
-
res = true
|
54
|
-
args.each do |a|
|
55
|
-
if a.is_a?(String) && !paths_once.include?(a)
|
56
|
-
res = false
|
57
|
-
elsif a.is_a?(Hash)
|
58
|
-
_a = a.symbolize_keys
|
59
|
-
if !paths_once.include?(_a[:partial])
|
60
|
-
res = false
|
61
|
-
elsif _a.key?(:id)
|
62
|
-
r = ary.select { |a| a['partial'] == _a[:partial] }.first
|
63
|
-
res = r['id'] == _a[:id]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
res
|
68
|
-
else
|
69
|
-
false
|
32
|
+
# count of rendered partials
|
33
|
+
# count rendering different partials (example: «customer/form»)
|
34
|
+
# doesnt check how often a specific partial is rendered
|
35
|
+
|
36
|
+
def partials_count
|
37
|
+
partials = []
|
38
|
+
partials_attributes.each do |p|
|
39
|
+
unless partials.include?(p[:partial])
|
40
|
+
partials.push(p[:partial])
|
70
41
|
end
|
71
|
-
else
|
72
|
-
paths_once
|
73
42
|
end
|
43
|
+
partials.length
|
74
44
|
end
|
75
45
|
|
76
46
|
# returns an array of hashes with the attributes used to call partials and the response (html as string) from the partial.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_turbo_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.40
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|