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: fceaabe20c5a6533f02917d1cc9512a7941980780ad94e5968b2fe594f9c300e
4
- data.tar.gz: 9d12b4e354a672f93e31544e6153b57b16e4ae9fd8c2fae8b316fc2c19c956d2
3
+ metadata.gz: 7b206d8b440a99024e367f647d886ec496c58965d343dfc6a7652d4d1e92a296
4
+ data.tar.gz: e4a1528314a586060ed43a425445eb0a72e5dd4266142455983d97dd70e4dffc
5
5
  SHA512:
6
- metadata.gz: f96b57506c02e8c106f2fac7c920750bd951b635d787c2170408d6aea397e1f3184926878d2306e701aade88a50630a0df7839358e8aa81509e7db43cca66285
7
- data.tar.gz: 9ddb505c068cbee6863abc72f2094448f8b68dc6df01201ef87a3dc3e645ca0898fb773da7bdb738facf60d985eeff5fc47eb49cacc696fc63f2e7d9c021ba89
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
- expect(partials_count).to eq(2)
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 TestHelpers
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
- partials_paths.length
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 partials_paths
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']) }
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "0.1.30"
2
+ VERSION = "0.1.32"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require "render_turbo_stream/version"
2
2
  require "render_turbo_stream/railtie"
3
3
  require 'render_turbo_stream/engine'
4
- require 'render_turbo_stream/test_helpers'
4
+ require 'render_turbo_stream/request_test_helpers'
5
5
 
6
6
  module RenderTurboStream
7
7
 
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.30
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/test_helpers.rb
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