Class: Inertia::RSpec::TestResponse
- Inherits:
-
Object
- Object
- Inertia::RSpec::TestResponse
- Defined in:
- lib/inertia/rspec.rb
Overview
Wraps an Inertia response for test assertions.
Instance Method Summary collapse
-
#component ⇒ String
Returns the component name.
-
#deferred_props ⇒ Hash
Returns the deferred props configuration.
-
#initialize(data) ⇒ TestResponse
constructor
A new instance of TestResponse.
-
#props ⇒ Hash{Symbol => Object}
Returns the props with symbolized keys.
Constructor Details
#initialize(data) ⇒ TestResponse
Returns a new instance of TestResponse.
22 23 24 |
# File 'lib/inertia/rspec.rb', line 22 def initialize(data) @data = data end |
Instance Method Details
#component ⇒ String
Returns the component name.
37 38 39 |
# File 'lib/inertia/rspec.rb', line 37 def component @data[:component] end |
#deferred_props ⇒ Hash
Returns the deferred props configuration.
44 45 46 |
# File 'lib/inertia/rspec.rb', line 44 def deferred_props @data[:deferredProps] || {} end |
#props ⇒ Hash{Symbol => Object}
Note:
To comply with the Inertia protocol, props always include the errors object.
Returns the props with symbolized keys.
30 31 32 |
# File 'lib/inertia/rspec.rb', line 30 def props sybmolize_keys(@data[:props]) end |