render_turbo_stream 0.1.29 → 0.1.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fd83f028af180b34e023bf8e1b3fb253542404e51b34052c20234e2a39f0d49
4
- data.tar.gz: 3718708775a5a332d5947c9a2c9a1beb4e0ae409cd1e70b6e67287a1f76d50c3
3
+ metadata.gz: 45e043a4b3096676a058b2558d29cfdd9e1580757f973464d727ef63e5cb54f8
4
+ data.tar.gz: d905cc69bd7b28c3bbd32ed807acd9386862446292acc90c5506e6d3e6a36bcf
5
5
  SHA512:
6
- metadata.gz: 0fe15f3a6697b46ac3bf94cbb8a8c56c9899e1cacb5e092147963e6b8fbca138f5db867a5f023018c3e8d65396d181eb1b737a0347f4e39556c484ae2bf55a62
7
- data.tar.gz: cab2f86053718391d43d098bfe6a45322f1e9b1eda5bf252f387e983835df771050cea36d737512cfa7dd2a69b8581ca99067f131732d1cd2be6f7ab4a30d3d0
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
- expect(partials_count).to eq(2)
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
- 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.29"
2
+ VERSION = "0.1.31"
3
3
  end
@@ -90,8 +90,8 @@ module RenderTurboStream
90
90
  flash_notices = []
91
91
  end
92
92
 
93
- flash_notices += add_flash_notices
94
- flash_alerts += add_flash_alerts
93
+ flash_notices += add_flash_notices.to_a
94
+ flash_alerts += add_flash_alerts.to_a
95
95
  _flash_id = Rails.configuration.x.render_turbo_stream.flash_id
96
96
  flash_id = (_flash_id ? _flash_id : "ERROR, MISSING CONFIG => config.x.render_turbo_stream.flash_id")
97
97
  flash_partial = Rails.configuration.x.render_turbo_stream.flash_partial
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.29
4
+ version: 0.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian