render_turbo_stream 0.1.44 → 0.1.45
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -9
- data/lib/render_turbo_stream/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 30eb2a0495b25d67ff59b2194b7b54cf20c8d0f813ade47a6809616d13231ba3
|
4
|
+
data.tar.gz: a934e1be22f6610a10fd16ce642a5601d8ef11224bfd1a9d70f1f1d471a83d71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c12cc64cbf409f74a7bf8f2faf6c6aa63fbe063a0bca4d8ec5939fea06b77011f873633e71daa44d6ef518f70686e382a115ac9c0da6b426413fb8665486c770
|
7
|
+
data.tar.gz: e6f689292afcc93064d1a67ee5d13a1bcd68a85cfb2b21a600624e5224585c4d5db7d6b21232ee30716924d5de82255ed321cab0a8ccf0d65c048aa7c9228325
|
data/README.md
CHANGED
@@ -122,17 +122,23 @@ RSpec.describe "Articles", type: :request do
|
|
122
122
|
expect(partials_log.join('')).to include('Article could not be created')
|
123
123
|
expect(partials_log.join('')).to include('layouts/flash')
|
124
124
|
|
125
|
-
|
126
|
-
#=> 2 partials in total: form, flash, no matter how many times each is rendered (example «flash»: a flash partial can be rendered several times)
|
125
|
+
# THERE ARE 3 COUNTS
|
127
126
|
|
128
|
-
|
129
|
-
|
130
|
-
expect(
|
131
|
-
#=> id is the ID that turbo-stream pointed to (for replace/append/... an item)
|
127
|
+
# A) Number of partials: "form" and "flash" are 2 partials
|
128
|
+
|
129
|
+
expect(partials_count).to eq(2)
|
132
130
|
|
133
|
-
|
134
|
-
|
135
|
-
|
131
|
+
# B) Total count of responses per partial (1 => is default)
|
132
|
+
|
133
|
+
expect(partial_response_count('articles/form', total: 1, id: 'form')).to be_truthy
|
134
|
+
# id is the html id to which turbo-stream is pointing.
|
135
|
+
|
136
|
+
# C) If a block is given: the number of matching responses returned by "partial_response_count".
|
137
|
+
|
138
|
+
expect(partial_response_count('flash'){|r|r.inner_html.include?('Article could not be created')}).to eq(1)
|
139
|
+
# result is either nil (if 0 matched) or a integer >= 1
|
140
|
+
|
141
|
+
expect(partial_response_count('flash'){|r|r.css('div').inner_html.include?('Article could not be created')}).to eq(1)
|
136
142
|
#=> you can use the validators of nokogiri, check: https://nokogiri.org/tutorials/parsing_an_html_xml_document.html
|
137
143
|
end
|
138
144
|
|