File tree Expand file tree Collapse file tree 1 file changed +98
-0
lines changed Expand file tree Collapse file tree 1 file changed +98
-0
lines changed Original file line number Diff line number Diff line change 1+ describe Matestack ::Ui ::Core ::Render do
2+ describe "#default_render" do
3+
4+ describe "implicit rendering for index actions" , type : :feature , js : true do
5+ before do
6+ module Clients
7+ end
8+
9+ class Clients ::BookingsController < ApplicationController
10+ include Matestack ::Ui ::Core ::ApplicationHelper
11+
12+ def index
13+ end
14+ end
15+
16+ Rails . application . routes . draw do
17+ namespace :clients do
18+ resources :bookings
19+ end
20+ end
21+
22+ class Apps ::Clients < Matestack ::Ui ::App
23+ def response
24+ components {
25+ page_content
26+ }
27+ end
28+ end
29+
30+ module Pages ::Clients
31+ end
32+
33+ class Pages ::Clients ::Bookings < Matestack ::Ui ::Page
34+ def response
35+ components {
36+ plain "Hello from the Pages::Clients::Bookings page."
37+ }
38+ end
39+ end
40+ end
41+ after do
42+ Rails . application . reload_routes!
43+ end
44+ specify do
45+ visit "/clients/bookings"
46+ expect ( page ) . to have_text "Hello from the Pages::Clients::Bookings page."
47+ end
48+ end
49+
50+ describe "implicit rendering for show actions" , type : :feature , js : true do
51+ before do
52+ module Clients
53+ end
54+
55+ class Clients ::BookingsController < ApplicationController
56+ include Matestack ::Ui ::Core ::ApplicationHelper
57+
58+ def show
59+ @id = params [ :id ]
60+ end
61+ end
62+
63+ Rails . application . routes . draw do
64+ namespace :clients do
65+ resources :bookings
66+ end
67+ end
68+
69+ class Apps ::Clients < Matestack ::Ui ::App
70+ def response
71+ components {
72+ page_content
73+ }
74+ end
75+ end
76+
77+ module Pages ::Clients
78+ end
79+
80+ class Pages ::Clients ::Booking < Matestack ::Ui ::Page # singular name `Booking`!
81+ def response
82+ components {
83+ plain "Hello from the Pages::Clients::Booking page with id #{ @id } ."
84+ }
85+ end
86+ end
87+ end
88+ after do
89+ Rails . application . reload_routes!
90+ end
91+ specify do
92+ visit "/clients/bookings/123"
93+ expect ( page ) . to have_text "Hello from the Pages::Clients::Booking page with id 123."
94+ end
95+ end
96+
97+ end
98+ end
You can’t perform that action at this time.
0 commit comments