render_turbo_stream 0.1.30 → 0.1.32
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: 7b206d8b440a99024e367f647d886ec496c58965d343dfc6a7652d4d1e92a296
|
4
|
+
data.tar.gz: e4a1528314a586060ed43a425445eb0a72e5dd4266142455983d97dd70e4dffc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aa70109f94e3e5eb963c7e0c45846d8686ee683e6bb0b6df2dff17b27f9d932a1d95e5c08221e931d190cf65cc85ddb81529580e07ef6e6295b2252d2815361e
|
7
|
+
data.tar.gz: c0ea50d8d082b7797c11f0b0e6b0d807aaf5ea736c60b11a079305ae02260eec216c08cdf71a499d419300982860ac0dca352b2166274381f5ea56ac73dede10
|
data/README.md
CHANGED
@@ -24,6 +24,14 @@ ApplicationController
|
|
24
24
|
include RenderTurboStream
|
25
25
|
```
|
26
26
|
|
27
|
+
spec/rails_helper.rb
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
RSpec.configure do |config|
|
31
|
+
config.include RenderTurboStream::RequestTestHelpers, type: :request
|
32
|
+
end
|
33
|
+
```
|
34
|
+
|
27
35
|
Redirection
|
28
36
|
|
29
37
|
For redirection to work, you must follow the installation steps from [turbo_power](https://github.com/marcoroth/turbo_power).
|
@@ -100,13 +108,20 @@ RSpec.describe "Articles", type: :request do
|
|
100
108
|
let(:invalid_params) { { article: { title: '', desciption: 'abc' } } }
|
101
109
|
|
102
110
|
it 'create failed' do
|
111
|
+
|
103
112
|
post articles_path(params: invalid_params)
|
104
113
|
|
114
|
+
# Which partials were rendered
|
115
|
+
expect(partials_count).to eq(2)
|
116
|
+
expect(partials).to include('layouts/flash', 'articles/form')
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
# ----- MORE OPTIONS -----
|
122
|
+
|
105
123
|
# to which html-ids turbo-stream would point
|
106
124
|
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
125
|
|
111
126
|
# 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
127
|
r = partial_response(id: 'flash-box')
|
@@ -125,7 +140,7 @@ RSpec.describe "Articles", type: :request do
|
|
125
140
|
expect(partials_responses(id: 'flash-box').length).to eq(1)
|
126
141
|
|
127
142
|
# Same with partials
|
128
|
-
|
143
|
+
|
129
144
|
expect(partials_responses(partial: 'layouts/flash').length).to eq(1)
|
130
145
|
end
|
131
146
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module RenderTurboStream
|
2
|
-
module
|
2
|
+
module RequestTestHelpers
|
3
3
|
|
4
4
|
# returns false if partial is rendered cero or multiple times
|
5
5
|
# response can be searched by nokogiri https://nokogiri.org/tutorials/searching_a_xml_html_document.html#basic-searching
|
@@ -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']) }
|
data/lib/render_turbo_stream.rb
CHANGED
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: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
@@ -43,7 +43,7 @@ files:
|
|
43
43
|
- lib/render_turbo_stream.rb
|
44
44
|
- lib/render_turbo_stream/engine.rb
|
45
45
|
- lib/render_turbo_stream/railtie.rb
|
46
|
-
- lib/render_turbo_stream/
|
46
|
+
- lib/render_turbo_stream/request_test_helpers.rb
|
47
47
|
- lib/render_turbo_stream/version.rb
|
48
48
|
- lib/tasks/render_turbo_stream_tasks.rake
|
49
49
|
homepage: https://gitlab.com/sedl/renderturbostream
|