Module: TurboRspec::Assertions
- Defined in:
- lib/turbo_rspec/assertions.rb
Overview
Minitest-compatible assertions. Include in your test class:
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase include TurboRspec::Assertions end
No RSpec dependency required.
Instance Method Summary collapse
-
#assert_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) ⇒ Object
Assert that a block broadcasts a +
+ to the given stream. - #assert_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object
- #assert_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object
-
#refute_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) ⇒ Object
Assert that a block does NOT broadcast a +
+ to the given stream. - #refute_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object
- #refute_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object
Instance Method Details
#assert_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) ⇒ Object
Assert that a block broadcasts a +
26 27 28 29 |
# File 'lib/turbo_rspec/assertions.rb', line 26 def assert_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) matcher = build_broadcast_matcher(stream, action: action, target: target, targets: targets, content: content, partial: partial) assert matcher.matches?(block), || matcher. end |
#assert_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object
50 51 52 53 |
# File 'lib/turbo_rspec/assertions.rb', line 50 def assert_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) matcher = build_frame_matcher(id: id, content: content, partial: partial) assert matcher.matches?(response_or_body), || matcher. end |
#assert_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object
40 41 42 43 |
# File 'lib/turbo_rspec/assertions.rb', line 40 def assert_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) matcher = build_stream_matcher(action: action, target: target, targets: targets, content: content, partial: partial) assert matcher.matches?(response_or_body), || matcher. end |
#refute_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) ⇒ Object
Assert that a block does NOT broadcast a +
35 36 37 38 |
# File 'lib/turbo_rspec/assertions.rb', line 35 def refute_broadcasted_turbo_stream_to(stream, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil, &block) matcher = build_broadcast_matcher(stream, action: action, target: target, targets: targets, content: content, partial: partial) assert matcher.does_not_match?(block), || matcher. end |
#refute_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object
55 56 57 58 |
# File 'lib/turbo_rspec/assertions.rb', line 55 def refute_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) matcher = build_frame_matcher(id: id, content: content, partial: partial) assert matcher.does_not_match?(response_or_body), || matcher. end |
#refute_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object
45 46 47 48 |
# File 'lib/turbo_rspec/assertions.rb', line 45 def refute_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) matcher = build_stream_matcher(action: action, target: target, targets: targets, content: content, partial: partial) assert matcher.does_not_match?(response_or_body), || matcher. end |