File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 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+ end
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+ end
22+ end
23+
24+ context 'when rendering through Inertia' do
25+ before do
26+ controller . instance_variable_set ( '@_inertia_rendering' , true )
27+ end
28+
29+ it 'returns true' do
30+ expect ( test_helper . inertia_rendering? ) . to be true
31+ end
32+ end
33+ end
34+ end
You can’t perform that action at this time.
0 commit comments