@@ -27,11 +27,6 @@ def test_styleguide_stubs
2727 } ,
2828 { id : 2 ,
2929 title : "You won't believe what happened to this man at Aspen"
30- } ,
31- {
32- id : 3 ,
33- title : "Testing form objects" ,
34- form : { "form_for" => "Object" }
3530 }
3631 ]
3732 }
@@ -52,11 +47,6 @@ def test_component_stubs
5247 {
5348 id : 2 ,
5449 title : "You won't believe what happened to this man at Aspen"
55- } ,
56- {
57- id : 3 ,
58- title : "Testing form objects" ,
59- form : { "form_for" => "Object" }
6050 }
6151 ]
6252 assert_instance_of Array , component . component_stubs
@@ -138,4 +128,18 @@ def test_stubs?
138128 assert_equal false , component_without_stub_file . stubs?
139129 assert_equal false , component_with_empty_stub_file . stubs?
140130 end
131+
132+ def test_component_stubs_pretty_json
133+ component = MountainView ::Component . new ( "form_custom_button" )
134+ component_properties = component . component_stubs . first
135+ json = JSON . pretty_generate component_properties
136+
137+ model_pattern = /Something.new\( {:name=>"blabla"}\) /
138+ form_pattern = /form_for\( Something.new\( {:name=>\" something name\" }\) \) /
139+
140+ p json
141+
142+ assert_match ( model_pattern , json )
143+ assert_match ( form_pattern , json )
144+ end
141145end
0 commit comments