instance method assert_in_body

Ruby on Rails 8.1.2

Since v8.1.2

Signature

assert_in_body(text)

Asserts that the given +text+ is present somewhere in the response body.

assert_in_body fixture(:name).description

Parameters

text req
Source
# File actionpack/lib/action_dispatch/testing/assertions/response.rb, line 77
      def assert_in_body(text)
        assert_match(/#{Regexp.escape(text)}/, @response.body)
      end

Defined in actionpack/lib/action_dispatch/testing/assertions/response.rb line 77 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionDispatch::Assertions::ResponseAssertions

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close