Module: InertiaHanami::Testing
- Defined in:
- lib/inertia_hanami/testing/rspec.rb
Overview
RSpec support for testing Inertia responses: matchers (have_props,
have_exact_props, have_no_prop, be_inertia_response,
render_component) plus partial-reload request helpers
(inertia_reload_only, inertia_reload_except,
inertia_load_deferred_props). Requires the host example group to
include Rack::Test::Methods (or otherwise provide last_response,
last_request, and get) - not auto-included, since a plain Rack env
is all this needs.
Ported from inertia-rails' inertia_rails/{testing,rspec}.rb, adapted
to this gem's lack of a swappable renderer factory (there is nothing to
monkeypatch to intercept the page hash, so TestResponse parses
last_response directly instead) and its lack of ActiveSupport.
Defined Under Namespace
Modules: Assertions, MatcherFactory, RequestHelpers Classes: TestResponse
Class Method Summary collapse
Class Method Details
.deep_symbolize_keys(value) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/inertia_hanami/testing/rspec.rb', line 21 def self.deep_symbolize_keys(value) case value when Hash value.each_with_object({}) { |(k, v), acc| acc[k.to_sym] = deep_symbolize_keys(v) } when Array value.map { |v| deep_symbolize_keys(v) } else value end end |