Module: Turbo::TestAssertions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/turbo/test_assertions.rb
Instance Method Summary collapse
- #assert_no_turbo_stream(action:, target: nil) ⇒ Object
- #assert_turbo_stream(action:, target: nil, status: :ok, &block) ⇒ Object
Instance Method Details
#assert_no_turbo_stream(action:, target: nil) ⇒ Object
16 17 18 19 |
# File 'lib/turbo/test_assertions.rb', line 16 def assert_no_turbo_stream(action:, target: nil) assert_equal Mime[:turbo_stream], response.media_type assert_select %(turbo-stream[action="#{action}"][target="#{target.respond_to?(:to_key) ? dom_id(target) : target}"]), count: 0 end |
#assert_turbo_stream(action:, target: nil, status: :ok, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/turbo/test_assertions.rb', line 10 def assert_turbo_stream(action:, target: nil, status: :ok, &block) assert_response status assert_equal Mime[:turbo_stream], response.media_type assert_select %(turbo-stream[action="#{action}"][target="#{target.respond_to?(:to_key) ? dom_id(target) : target}"]), count: 1, &block end |