render_turbo_stream 3.0.1 → 3.0.3

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: ef24460b794e7db6757f2ad199e94f9ce7df38615b9ed64bcdcfc0af978cf573
4
- data.tar.gz: 1c14768ff0ee5277befcb9d039c37b7df5e549cf3f23910672583099ab387590
3
+ metadata.gz: 14a45858fbfebd69a6546511f25a1c46566a8f4911c788ea52b76538132748a6
4
+ data.tar.gz: f87599a585edcbc7393a6e06749afb6dd7e1bcfcba5a899b8ad0c09223edc63d
5
5
  SHA512:
6
- metadata.gz: 805e49cacca8b70246a6549c52a7e4bde532989ab80dcd375e0c238ed880aedf55a6f51ebc1275b030ad81daf6dae81753ffdb3590af14ba309383a7aa9473da
7
- data.tar.gz: 5d7f808aaf2fa1b77338fbf8f4f236ec41bcf1c4b89113e9d55608a56ac349416a8a91e3fb951b387383b937cdd125c2c19816fad78191bfc0285245e41ef854
6
+ metadata.gz: 37b4458882a14d7e50f186a725b7b9a5b14a2da0d452bfba41d24fd2c73cebff9e1c2de4f8f951af71c6ca5f089bb29c5caa66ac3e9140030f43cc394065d27a
7
+ data.tar.gz: cc3fd5383fab67929924353fbd41280dd07b9588fb38317cb2bd5c0eb13c26524ec84742126afbe4756b28fe2ee446aaac78941ea9a76f86f6927cbe9ef20a70
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  DHH made a milestone in web development with [Rails 7, "Fulfilling a Vision"](https://rubyonrails.org/2021/12/15/Rails-7-fulfilling-a-vision). This gem is my contribution to that bold new step. The goal is to have a complete rails like workflow.
4
4
 
5
- Defining templates like `(create|update).turbo_stream.haml` annoyed me. Because it is a heavy mix of logic and view. Working consistently with turbo_stream or Turbo Streams Channel means shooting a lot of partials from the backend to the frontend. There are many ways and tedious details to handle redirects since Turbo! There is a lot that can be streamlined.
5
+ Defining templates like `(create|update).turbo_stream.haml` annoyed me. Because it is a heavy mix of logic and view. Working consistently with turbo_stream or Turbo Streams Channel means shooting a lot of partials from the backend to the frontend. There are many ways and tedious details to handle redirects since Turbo! This all can be streamlined.
6
6
 
7
7
  Execute [turbo_power](https://github.com/marcoroth/turbo_power) commands such as adding a css class to an html element, pushing a state to the browser history, or running custom javascript actions through Turbo Stream can be written in pure ruby code. No need for embeds like `.html.erb`.
8
8
 
@@ -248,8 +248,11 @@ assert_stream_response('form'){|e|e.css('.field_with_errors').inner_html.include
248
248
  # make sure that there is one response to the target '#form' and it checks the rendered content
249
249
  # if cero or more responses are expected, add a attribute like 'count: 0'
250
250
  ```
251
+
251
252
  Possible matchers can be found at [Nokogiri](https://nokogiri.org/tutorials/searching_a_xml_html_document.html).
252
253
 
254
+ The `assert_stream_response`, like the other matchers, checks by default that the same target is not affected multiple times by the `:replace` action within the same response. This is defined in the underlying `RenderTurboStream::Test::Request::Libs.select_responses` method, which is also used for the `assert_channel_to_*` methods.
255
+
253
256
  ```ruby
254
257
  # check actions from turbo_power gem
255
258
  assert_stream_response('colored-element', action: 'remove_css_class') {|args| args.last == 'background-red' }
@@ -155,7 +155,7 @@ module RenderTurboStream
155
155
  ])
156
156
  elsif save_action && redirect_on_success_to.present?
157
157
  response.status = 302
158
- if Rails.configuration.x.render_turbo_stream.use_channel_for_turbo_stream_save && helpers.user_signed_in?
158
+ if (Rails.configuration.x.render_turbo_stream.use_channel_for_turbo_stream_save rescue false) && (helpers.current_user.id.present? rescue false)
159
159
  streams.each do |s|
160
160
  next unless s.is_a?(Hash)
161
161
  Rails.logger.debug(" • Send by Cable => «#{s}»")
@@ -1,3 +1,3 @@
1
1
  module RenderTurboStream
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: render_turbo_stream
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - christian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-09 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -80,6 +80,6 @@ requirements: []
80
80
  rubygems_version: 3.4.12
81
81
  signing_key:
82
82
  specification_version: 4
83
- summary: Complete rails-like workflow for turbo streams and channels. With testing
84
- strategy.
83
+ summary: Complete workflow for turbo streams and channels. With testing strategy.
84
+ Rails like.
85
85
  test_files: []