Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Point ViewComponent 4 at LookbooksController so previews render (#3810)

Guillem Arias Fausteda3e116dcc36
diff --git a/config/application.rb b/config/application.rb
index 73773e4985..8f9fdca531 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -34,7 +34,7 @@ module Sure
config.active_record.encryption = Rails.application.credentials.active_record_encryption
end
- config.view_component.preview_controller = "LookbooksController"
+ config.view_component.previews.controller = "LookbooksController"
config.lookbook.preview_display_options = {
theme: [ "light", "dark" ] # available in view as params[:theme]
}
diff --git a/test/controllers/lookbooks_controller_test.rb b/test/controllers/lookbooks_controller_test.rb
new file mode 100644
index 0000000000..127d8e6521
--- /dev/null
+++ b/test/controllers/lookbooks_controller_test.rb
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class LookbooksControllerTest < ActionDispatch::IntegrationTest
+ test "renders a component preview in the lookbooks layout" do
+ get "/design-system/preview/detail_row/default"
+
+ assert_response :success
+ assert_select "title", "Component Preview"
+ assert_select "body", text: /TARGET 00023 SAN MATEO CA/
+ end
+end