render_turbo_stream 0.1.30 → 0.1.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -4
- data/lib/render_turbo_stream/test_helpers.rb +2 -2
- 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: 45e043a4b3096676a058b2558d29cfdd9e1580757f973464d727ef63e5cb54f8
|
4
|
+
data.tar.gz: d905cc69bd7b28c3bbd32ed807acd9386862446292acc90c5506e6d3e6a36bcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ff9c676ed207c0b59eb1f3949b69c73f482100c2d775ebba417acebba2fbfe0ff25e0d10906b752101b391e9d47f5c2147e60feef0c87b7a291b81fdf86a1f5
|
7
|
+
data.tar.gz: 145930ea3e14e690b8c27cce58338daf236f562b7fbb9119532656669180c6d63f3fad5a4f386e34a1c19cc0e9b1419a621d45c9d5f5e8816f7d1b8865e662b7
|
data/README.md
CHANGED
@@ -100,13 +100,20 @@ RSpec.describe "Articles", type: :request do
|
|
100
100
|
let(:invalid_params) { { article: { title: '', desciption: 'abc' } } }
|
101
101
|
|
102
102
|
it 'create failed' do
|
103
|
+
|
103
104
|
post articles_path(params: invalid_params)
|
104
105
|
|
106
|
+
# Which partials were rendered
|
107
|
+
expect(partials_count).to eq(2)
|
108
|
+
expect(partials).to include('layouts/flash', 'articles/form')
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
# ----- MORE OPTIONS -----
|
114
|
+
|
105
115
|
# to which html-ids turbo-stream would point
|
106
116
|
expect(partials_ids).to include('flash-box', 'form')
|
107
|
-
|
108
|
-
# which partials were rendered
|
109
|
-
expect(partials_paths).to include('layouts/flash', 'articles/form')
|
110
117
|
|
111
118
|
# partial_response (singular) returns false unless partial responded exactly one time, otherwise the content in nokogiri format: https://nokogiri.org/tutorials/searching_a_xml_html_document.html#basic-searching
|
112
119
|
r = partial_response(id: 'flash-box')
|
@@ -125,7 +132,7 @@ RSpec.describe "Articles", type: :request do
|
|
125
132
|
expect(partials_responses(id: 'flash-box').length).to eq(1)
|
126
133
|
|
127
134
|
# Same with partials
|
128
|
-
|
135
|
+
|
129
136
|
expect(partials_responses(partial: 'layouts/flash').length).to eq(1)
|
130
137
|
end
|
131
138
|
end
|
@@ -34,7 +34,7 @@ module RenderTurboStream
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def partials_count
|
37
|
-
|
37
|
+
partials.length
|
38
38
|
end
|
39
39
|
|
40
40
|
# array of strings of ids of rendered partials that turbo_stream pointed to
|
@@ -46,7 +46,7 @@ module RenderTurboStream
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# array of strings of paths by which partials are rendered, for example: ['articles/form'].
|
49
|
-
def
|
49
|
+
def partials
|
50
50
|
ary = partials_attributes
|
51
51
|
paths = []
|
52
52
|
ary.each {|a| paths.push(a['partial']) unless paths.include?(a['partial']) }
|