Module: TurboRspec::Matchers
- Defined in:
- lib/turbo_rspec/matchers.rb,
lib/turbo_rspec/matchers/have_turbo_frame.rb,
lib/turbo_rspec/matchers/have_turbo_stream.rb,
lib/turbo_rspec/matchers/have_turbo_streams.rb,
lib/turbo_rspec/matchers/have_broadcasted_turbo_stream_to.rb
Overview
RSpec matchers for Turbo Stream and Turbo Frame assertions. Auto-included in +type: :request+ and +type: :controller+ example groups. Include explicitly for other contexts:
RSpec.configure do |config| config.include TurboRspec::Matchers end
Defined Under Namespace
Classes: HaveBroadcastedTurboStreamTo, HaveTurboFrame, HaveTurboStream, HaveTurboStreams
Instance Method Summary collapse
-
#have_broadcasted_turbo_stream_to(stream_or_object) ⇒ HaveBroadcastedTurboStreamTo
(also: #broadcast_turbo_stream_to)
Assert that a block broadcasts a +
+ to the given stream. -
#have_turbo_frame ⇒ HaveTurboFrame
Assert that a response body contains a +
+ element. -
#have_turbo_stream ⇒ HaveTurboStream
(also: #assert_no_turbo_stream)
Assert that a response body contains a +
+ element. -
#have_turbo_streams(*matchers) ⇒ HaveTurboStreams
Assert that a response body contains all of the given turbo streams.
Instance Method Details
#have_broadcasted_turbo_stream_to(stream_or_object) ⇒ HaveBroadcastedTurboStreamTo Also known as: broadcast_turbo_stream_to
Assert that a block broadcasts a +
20 21 22 |
# File 'lib/turbo_rspec/matchers.rb', line 20 def have_broadcasted_turbo_stream_to(stream_or_object) HaveBroadcastedTurboStreamTo.new(stream_or_object) end |
#have_turbo_frame ⇒ HaveTurboFrame
Assert that a response body contains a +
29 30 31 |
# File 'lib/turbo_rspec/matchers.rb', line 29 def have_turbo_frame HaveTurboFrame.new end |
#have_turbo_stream ⇒ HaveTurboStream Also known as: assert_no_turbo_stream
Assert that a response body contains a +
35 36 37 |
# File 'lib/turbo_rspec/matchers.rb', line 35 def have_turbo_stream HaveTurboStream.new end |
#have_turbo_streams(*matchers) ⇒ HaveTurboStreams
Assert that a response body contains all of the given turbo streams.
46 47 48 |
# File 'lib/turbo_rspec/matchers.rb', line 46 def have_turbo_streams(*matchers) HaveTurboStreams.new(matchers) end |