@@ -56,12 +56,11 @@ def test_dynamic_attributes_nested_hash
5656 end
5757
5858 def test_dynamic_attributes_nested_hash_single_quotes
59- with_single_quotes do
60- assert_format (
61- "%div{data: { controller: \" lesson-evaluation\" }}" ,
62- "%div{data: { controller: 'lesson-evaluation' }}"
63- )
64- end
59+ assert_format (
60+ "%div{data: { controller: \" lesson-evaluation\" }}" ,
61+ "%div{data: { controller: 'lesson-evaluation' }}" ,
62+ options : SyntaxTree ::Formatter ::Options . new ( quote : "'" )
63+ )
6564 end
6665
6766 def test_dynamic_attributes_integers
@@ -84,12 +83,11 @@ def test_dynamic_attributes_strings
8483 end
8584
8685 def test_dynamic_attributes_strings_single_quotes
87- with_single_quotes do
88- assert_format (
89- "%section(xml:lang=\" en\" title=\" title\" )" ,
90- "%section{'xml:lang': 'en', title: 'title'}"
91- )
92- end
86+ assert_format (
87+ "%section(xml:lang=\" en\" title=\" title\" )" ,
88+ "%section{'xml:lang': 'en', title: 'title'}" ,
89+ options : SyntaxTree ::Formatter ::Options . new ( quote : "'" )
90+ )
9391 end
9492
9593 def test_dynamic_attributes_with_at
@@ -137,25 +135,15 @@ def test_quotes_in_strings
137135 end
138136
139137 def test_interpolation_in_strings
140- with_single_quotes { assert_format ( <<~HAML ) }
138+ source = <<~HAML
141139 %div{style: "background: center/cover url(\# {url_for(page.resource.file)})"}
142140 HAML
141+
142+ options = SyntaxTree ::Formatter ::Options . new ( quote : "'" )
143+ assert_format ( source , options : options )
143144 end
144145
145146 def test_interpolation_in_value
146147 assert_format ( "%p <small>hello</small>\" \# {1 + 2} little pigs\" " )
147148 end
148-
149- private
150-
151- def with_single_quotes
152- quote = SyntaxTree ::Formatter ::OPTIONS [ :quote ]
153- SyntaxTree ::Formatter ::OPTIONS [ :quote ] = "'"
154-
155- begin
156- yield
157- ensure
158- SyntaxTree ::Formatter ::OPTIONS [ :quote ] = quote
159- end
160- end
161149end
0 commit comments