module Turbo::TestAssertions
Public Instance Methods
assert_no_turbo_stream(action:, target: nil, targets: nil)
click to toggle source
# File lib/turbo/test_assertions.rb, line 19 def assert_no_turbo_stream(action:, target: nil, targets: nil) assert_equal Mime[:turbo_stream], response.media_type selector = %(turbo-stream[action="#{action}"]) selector << %([target="#{target.respond_to?(:to_key) ? dom_id(target) : target}"]) if target selector << %([targets="#{targets}"]) if targets assert_select selector, count: 0 end
assert_turbo_stream(action:, target: nil, targets: nil, status: :ok, &block)
click to toggle source
# File lib/turbo/test_assertions.rb, line 10 def assert_turbo_stream(action:, target: nil, targets: nil, status: :ok, &block) assert_response status assert_equal Mime[:turbo_stream], response.media_type selector = %(turbo-stream[action="#{action}"]) selector << %([target="#{target.respond_to?(:to_key) ? dom_id(target) : target}"]) if target selector << %([targets="#{targets}"]) if targets assert_select selector, count: 1, &block end