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

Instance Method Details

#assert_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object



25
26
27
28
# File 'lib/turbo_rspec/assertions.rb', line 25

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), message || matcher.failure_message
end

#assert_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object



15
16
17
18
# File 'lib/turbo_rspec/assertions.rb', line 15

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), message || matcher.failure_message
end

#refute_turbo_frame(response_or_body, id: nil, content: nil, partial: nil, message: nil) ⇒ Object



30
31
32
33
# File 'lib/turbo_rspec/assertions.rb', line 30

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), message || matcher.failure_message_when_negated
end

#refute_turbo_stream(response_or_body, action: nil, target: nil, targets: nil, content: nil, partial: nil, message: nil) ⇒ Object



20
21
22
23
# File 'lib/turbo_rspec/assertions.rb', line 20

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), message || matcher.failure_message_when_negated
end