render_turbo_stream 1.2.0 → 1.2.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd9433b4adbd71cc1c6200b10b969c3692772f4cc8a4b21e0e02948e58104a3a
|
4
|
+
data.tar.gz: 21f9ba3336cdc8875300738885eee417a971fe4f6364c81ca9e772579ba80f10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e50b4ec7e474c6f8c4476f49eb97e6d1088308182d1b3d9d7ecb31fcbc491a940b6cf71046c4626cca36f8234e3008fc09b8bf6ae8ac12473ca04c795cf8faea
|
7
|
+
data.tar.gz: a5c91d74dce4bc5031da22fa702a74d3a8e5eff0aa19ed7bdd7296a9dc6e369c0e7a51cdfb964c316a4f3bddc12c3635af557113ae1d96d7f67d4715fb16cced
|
data/README.md
CHANGED
@@ -110,7 +110,7 @@ If you want to check if a controller action succeeded, just check for `response.
|
|
110
110
|
For rspec there is a special helper, for a successful save action:
|
111
111
|
|
112
112
|
```ruby
|
113
|
-
|
113
|
+
it 'update failed' do
|
114
114
|
patch article_path(article, params: valid_params)
|
115
115
|
expect_successful_saved('form', 'flash-box')
|
116
116
|
# expects response.status 200
|
@@ -145,7 +145,7 @@ expect(partial_response('articles/form', id: 'form', css: '.field_with_errors',
|
|
145
145
|
|
146
146
|
Consider a controller action that should respond in 2 flashes.
|
147
147
|
|
148
|
-
Helper for writing the test: On Debugger, inside the test,
|
148
|
+
Helper for writing the test: On Debugger, inside the test, check the output of `partials_log`.
|
149
149
|
|
150
150
|
```ruby
|
151
151
|
expect(partials_count).to eq(1)
|
@@ -164,7 +164,7 @@ expect(
|
|
164
164
|
```
|
165
165
|
`partial_response_count` always returns the number of matched responses.
|
166
166
|
|
167
|
-
Possible
|
167
|
+
Possible matchers can be found at [Nokogiri](https://nokogiri.org/tutorials/searching_a_xml_html_document.html). That should be enough for this level. For more detailed testing of partials, there are view tests. And many of the partials are regularly accessed in two ways, for example a `form': it is pushed by turbo_stream as well as by calling edit_customer_path.
|
168
168
|
|
169
169
|
P.S.:
|
170
170
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
<% streams.each do |s| %>
|
4
4
|
|
5
|
-
<% html = (render s[:partial], locals: s[:locals]
|
5
|
+
<% html = (render s[:partial], locals: s[:locals]&.symbolize_keys, formats: [:html]) %>
|
6
6
|
|
7
7
|
<% rendered_partials.push({ html_response: html }.merge(s)) %>
|
8
8
|
|
@@ -17,21 +17,21 @@
|
|
17
17
|
<% ctl[:action] = :replace %>
|
18
18
|
<% Rails.logger.debug(" • render-turbo-stream REPLACE => #{info}") %>
|
19
19
|
<%= turbo_stream.replace s[:id] do %>
|
20
|
-
<%= render s[:partial], locals: s[:locals]
|
20
|
+
<%= render s[:partial], locals: s[:locals]&.symbolize_keys %>
|
21
21
|
<% end %>
|
22
22
|
|
23
23
|
<% elsif s[:action].to_sym == :prepend %>
|
24
24
|
<% ctl[:action] = :prepend %>
|
25
25
|
<% Rails.logger.debug(" • render-turbo-stream PREPEND => #{info}") %>
|
26
26
|
<%= turbo_stream.prepend s[:id] do %>
|
27
|
-
<%= render s[:partial], locals: s[:locals]
|
27
|
+
<%= render s[:partial], locals: s[:locals]&.symbolize_keys %>
|
28
28
|
<% end %>
|
29
29
|
|
30
30
|
<% elsif s[:action].to_sym == :append %>
|
31
31
|
<% ctl[:action] = :append %>
|
32
32
|
<% Rails.logger.debug(" • render-turbo-stream APPEND => #{info}") %>
|
33
33
|
<%= turbo_stream.prepend s[:id] do %>
|
34
|
-
<%= render s[:partial], locals: s[:locals]
|
34
|
+
<%= render s[:partial], locals: s[:locals]&.symbolize_keys %>
|
35
35
|
<% end %>
|
36
36
|
|
37
37
|
<% else %>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: render_turbo_stream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
@@ -72,5 +72,6 @@ requirements: []
|
|
72
72
|
rubygems_version: 3.4.12
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
|
-
summary: Render turbo-stream
|
75
|
+
summary: Render partials by turbo-stream directly from the controller. Test helpers
|
76
|
+
included.
|
76
77
|
test_files: []
|