We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
inertia_rendering?
1 parent 39131ab commit 085e936Copy full SHA for 085e936
spec/inertia/helper_spec.rb
@@ -0,0 +1,34 @@
1
+# frozen_string_literal: true
2
+
3
+RSpec.describe InertiaRails::Helper do
4
+ let(:controller) { ApplicationController.new }
5
6
+ let(:test_helper) do
7
+ Class.new do
8
+ include InertiaRails::Helper
9
+ attr_accessor :controller
10
+ end.new
11
+ end
12
13
+ before do
14
+ test_helper.controller = controller
15
16
17
+ describe '#inertia_rendering?' do
18
+ context 'when not rendering through Inertia' do
19
+ it 'returns nil' do
20
+ expect(test_helper.inertia_rendering?).to be_nil
21
22
23
24
+ context 'when rendering through Inertia' do
25
26
+ controller.instance_variable_set('@_inertia_rendering', true)
27
28
29
+ it 'returns true' do
30
+ expect(test_helper.inertia_rendering?).to be true
31
32
33
34
+end
0 commit comments