Module: InertiaRails::RSpec::Helpers

Defined in:
lib/inertia_rails/rspec.rb

Instance Method Summary collapse

Instance Method Details

#expect_inertiaObject



60
61
62
# File 'lib/inertia_rails/rspec.rb', line 60

def expect_inertia
  expect(inertia)
end

#inertiaObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/inertia_rails/rspec.rb', line 45

def inertia
  unless inertia_tests_setup?
    raise "Inertia test helpers aren't set up! " \
          'Make sure you add `inertia: true` to describe blocks using inertia tests.'
  end

  if @_inertia_render_wrapper.nil? && !::RSpec.configuration.inertia[:skip_missing_renderer_warnings]
    warn 'WARNING: the test never created an Inertia renderer. ' \
         "Maybe the code wasn't able to reach a `render inertia:` call? If this was intended, " \
         "or you don't want to see this message, " \
         'set ::RSpec.configuration.inertia[:skip_missing_renderer_warnings] = true'
  end
  @_inertia_render_wrapper
end

#inertia_wrap_render(render) ⇒ Object



64
65
66
# File 'lib/inertia_rails/rspec.rb', line 64

def inertia_wrap_render(render)
  @_inertia_render_wrapper = InertiaRenderWrapper.new.wrap_render(render)
end