slim 2.1.0 → 3.0.0.beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +10 -24
  3. data/CHANGES +8 -0
  4. data/Gemfile +5 -7
  5. data/README.jp.md +29 -31
  6. data/README.md +34 -34
  7. data/Rakefile +9 -7
  8. data/benchmarks/context.rb +3 -3
  9. data/benchmarks/run-benchmarks.rb +9 -9
  10. data/benchmarks/view.slim +1 -1
  11. data/doc/jp/logic_less.md +7 -7
  12. data/doc/logic_less.md +7 -7
  13. data/lib/slim/command.rb +6 -16
  14. data/lib/slim/embedded.rb +10 -13
  15. data/lib/slim/engine.rb +21 -23
  16. data/lib/slim/erb_converter.rb +2 -1
  17. data/lib/slim/include.rb +2 -2
  18. data/lib/slim/logic_less.rb +1 -2
  19. data/lib/slim/logic_less/filter.rb +3 -3
  20. data/lib/slim/parser.rb +43 -19
  21. data/lib/slim/smart.rb +3 -3
  22. data/lib/slim/smart/escaper.rb +1 -1
  23. data/lib/slim/smart/filter.rb +3 -3
  24. data/lib/slim/smart/parser.rb +6 -4
  25. data/lib/slim/splat/builder.rb +9 -4
  26. data/lib/slim/splat/filter.rb +3 -4
  27. data/lib/slim/template.rb +5 -5
  28. data/lib/slim/translator.rb +12 -13
  29. data/lib/slim/version.rb +1 -1
  30. data/slim.gemspec +3 -1
  31. data/test/core/helper.rb +3 -3
  32. data/test/core/test_code_escaping.rb +14 -14
  33. data/test/core/test_code_evaluation.rb +1 -1
  34. data/test/core/test_code_output.rb +1 -1
  35. data/test/core/test_embedded_engines.rb +16 -16
  36. data/test/core/test_encoding.rb +4 -4
  37. data/test/core/test_html_attributes.rb +9 -9
  38. data/test/core/test_html_structure.rb +20 -20
  39. data/test/core/test_parser_errors.rb +1 -1
  40. data/test/core/test_pretty.rb +4 -4
  41. data/test/core/test_ruby_errors.rb +5 -5
  42. data/test/core/test_slim_template.rb +2 -2
  43. data/test/core/test_tabs.rb +5 -5
  44. data/test/core/test_thread_options.rb +4 -4
  45. data/test/core/test_unicode.rb +11 -13
  46. data/test/include/test_include.rb +2 -2
  47. data/test/literate/TESTS.md +37 -8
  48. data/test/literate/helper.rb +2 -2
  49. data/test/logic_less/test_logic_less.rb +37 -37
  50. data/test/rails/app/controllers/slim_controller.rb +3 -3
  51. data/test/rails/config/initializers/session_store.rb +1 -1
  52. data/test/rails/config/routes.rb +4 -4
  53. data/test/rails/test/test_slim.rb +9 -15
  54. data/test/smart/test_smart_text.rb +5 -9
  55. data/test/translator/test_translator.rb +14 -14
  56. metadata +7 -7
@@ -259,7 +259,7 @@ Hello, World!
259
259
  You can also write loops like this
260
260
 
261
261
  ~~~ slim
262
- - items = [{:name => 'table', :price => 10}, {:name => 'chair', :price => 5}]
262
+ - items = [{name: 'table', price: 10}, {name: 'chair', price: 5}]
263
263
  table#items
264
264
  - for item in items do
265
265
  tr
@@ -293,7 +293,7 @@ which renders as
293
293
  The `do` keyword can be omitted.
294
294
 
295
295
  ~~~ slim
296
- - items = [{:name => 'table', :price => 10}, {:name => 'chair', :price => 5}]
296
+ - items = [{name: 'table', price: 10}, {name: 'chair', price: 5}]
297
297
  table#items
298
298
  - for item in items
299
299
  tr
@@ -1099,7 +1099,7 @@ with the :tag key.
1099
1099
  ~~~ slim
1100
1100
  ruby:
1101
1101
  def a_unless_current
1102
- @page_current ? {:tag => 'span'} : {:tag => 'a', :href => 'http://slim-lang.com/'}
1102
+ @page_current ? {tag: 'span'} : {tag: 'a', href: 'http://slim-lang.com/'}
1103
1103
  end
1104
1104
  - @page_current = true
1105
1105
  *a_unless_current Link
@@ -1120,7 +1120,7 @@ renders as
1120
1120
  We add tag shortcuts by setting the option `:shortcut`.
1121
1121
 
1122
1122
  ~~~ options
1123
- :shortcut => {'c' => {:tag => 'container'}, 'sec' => {:tag =>'section'}, '#' => {:attr => 'id'}, '.' => {:attr => 'class'} }
1123
+ :shortcut => {'c' => {tag: 'container'}, 'sec' => {tag:'section'}, '#' => {attr: 'id'}, '.' => {attr: 'class'} }
1124
1124
  ~~~
1125
1125
 
1126
1126
  ~~~ slim
@@ -1140,7 +1140,7 @@ renders to
1140
1140
  We add `&` to create a shortcut for the input elements with type attribute by setting the option `:shortcut`.
1141
1141
 
1142
1142
  ~~~ options
1143
- :shortcut => {'&' => {:tag => 'input', :attr => 'type'}, '#' => {:attr => 'id'}, '.' => {:attr => 'class'} }
1143
+ :shortcut => {'&' => {tag: 'input', attr: 'type'}, '#' => {attr: 'id'}, '.' => {attr: 'class'} }
1144
1144
  ~~~
1145
1145
 
1146
1146
  ~~~ slim
@@ -1158,7 +1158,7 @@ renders to
1158
1158
  This is stupid, but you can also use multiple character shortcuts.
1159
1159
 
1160
1160
  ~~~ options
1161
- :shortcut => {'&' => {:tag => 'input', :attr => 'type'}, '#<' => {:attr => 'id'}, '#>' => {:attr => 'class'} }
1161
+ :shortcut => {'&' => {tag: 'input', attr: 'type'}, '#<' => {attr: 'id'}, '#>' => {attr: 'class'} }
1162
1162
  ~~~
1163
1163
 
1164
1164
  ~~~ slim
@@ -1176,7 +1176,7 @@ renders to
1176
1176
  You can also set multiple attributes per shortcut.
1177
1177
 
1178
1178
  ~~~ options
1179
- :shortcut => {'.' => {:attr => %w(id class)} }
1179
+ :shortcut => {'.' => {attr: %w(id class)} }
1180
1180
  ~~~
1181
1181
 
1182
1182
  ~~~ slim
@@ -1192,7 +1192,7 @@ renders to
1192
1192
  Shortcuts can also have multiple characters.
1193
1193
 
1194
1194
  ~~~ options
1195
- :shortcut => {'.' => {:attr => 'class'}, '#' => {:attr => 'id'}, '.#' => {:attr => %w(class id)} }
1195
+ :shortcut => {'.' => {attr: 'class'}, '#' => {attr: 'id'}, '.#' => {attr: %w(class id)} }
1196
1196
  ~~~
1197
1197
 
1198
1198
  ~~~ slim
@@ -1254,6 +1254,35 @@ renders as
1254
1254
  </h1>
1255
1255
  ~~~
1256
1256
 
1257
+ ## Pretty printing of XML
1258
+
1259
+ We can enable XML mode with
1260
+
1261
+ ~~~ options
1262
+ :format => :xml
1263
+ ~~~
1264
+
1265
+ ~~~ slim
1266
+ doctype xml
1267
+ document
1268
+ closed-element/
1269
+ element(boolean-attribute)
1270
+ child attribute="value"
1271
+ | content
1272
+ ~~~
1273
+
1274
+ ~~~ html
1275
+ <?xml version="1.0" encoding="utf-8" ?>
1276
+ <document>
1277
+ <closed-element />
1278
+ <element boolean-attribute="">
1279
+ <child attribute="value">
1280
+ content
1281
+ </child>
1282
+ </element>
1283
+ </document>
1284
+ ~~~
1285
+
1257
1286
  ## Embedded engines
1258
1287
 
1259
1288
  ## Configuring Slim
@@ -4,9 +4,9 @@ require 'slim/translator'
4
4
  require 'slim/grammar'
5
5
  require 'minitest/autorun'
6
6
 
7
- Slim::Engine.after Slim::Parser, Temple::Filters::Validator, :grammar => Slim::Grammar
7
+ Slim::Engine.after Slim::Parser, Temple::Filters::Validator, grammar: Slim::Grammar
8
8
  Slim::Engine.before :Pretty, Temple::Filters::Validator
9
- Slim::Engine.set_default_options :tr => false, :logic_less => false
9
+ Slim::Engine.set_options tr: false, logic_less: false
10
10
 
11
11
  class MiniTest::Spec
12
12
  def render(source, options = {}, &block)
@@ -5,9 +5,9 @@ class TestSlimLogicLess < TestSlim
5
5
  class Scope
6
6
  def initialize
7
7
  @hash = {
8
- :person => [
9
- { :name => 'Joe', :age => 1, :selected => true },
10
- { :name => 'Jack', :age => 2 }
8
+ person: [
9
+ { name: 'Joe', age: 1, selected: true },
10
+ { name: 'Jack', age: 2 }
11
11
  ]
12
12
  }
13
13
  end
@@ -25,22 +25,22 @@ p
25
25
  }
26
26
 
27
27
  hash = {
28
- :hello => 'Hello!',
29
- :person => lambda do |&block|
28
+ hello: 'Hello!',
29
+ person: lambda do |&block|
30
30
  %w(Joe Jack).map do |name|
31
- "<b>#{block.call(:name => name)}</b>"
31
+ "<b>#{block.call(name: name)}</b>"
32
32
  end.join
33
33
  end,
34
- :simple => lambda do |&block|
34
+ simple: lambda do |&block|
35
35
  "<div class=\"simple\">#{block.call}</div>"
36
36
  end,
37
- :list => lambda do |&block|
38
- list = [{:key => 'First'}, {:key => 'Second'}]
37
+ list: lambda do |&block|
38
+ list = [{key: 'First'}, {key: 'Second'}]
39
39
  "<ul>#{block.call(*list)}</ul>"
40
40
  end
41
41
  }
42
42
 
43
- assert_html '<p><b><div class="name">Joe</div></b><b><div class="name">Jack</div></b><div class="simple"><div class="hello">Hello!</div></div><ul><li>First</li><li>Second</li></ul></p>', source, :scope => hash
43
+ assert_html '<p><b><div class="name">Joe</div></b><b><div class="name">Jack</div></b><div class="simple"><div class="hello">Hello!</div></div><ul><li>First</li><li>Second</li></ul></p>', source, scope: hash
44
44
  end
45
45
 
46
46
  def test_symbol_hash
@@ -51,13 +51,13 @@ p
51
51
  }
52
52
 
53
53
  hash = {
54
- :person => [
55
- { :name => 'Joe', },
56
- { :name => 'Jack', }
54
+ person: [
55
+ { name: 'Joe', },
56
+ { name: 'Jack', }
57
57
  ]
58
58
  }
59
59
 
60
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => hash
60
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: hash
61
61
  end
62
62
 
63
63
  def test_string_access
@@ -74,7 +74,7 @@ p
74
74
  ]
75
75
  }
76
76
 
77
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => hash, :dictionary_access => :string
77
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: hash, dictionary_access: :string
78
78
  end
79
79
 
80
80
  def test_symbol_access
@@ -85,13 +85,13 @@ p
85
85
  }
86
86
 
87
87
  hash = {
88
- :person => [
89
- { :name => 'Joe', },
90
- { :name => 'Jack', }
88
+ person: [
89
+ { name: 'Joe', },
90
+ { name: 'Jack', }
91
91
  ]
92
92
  }
93
93
 
94
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => hash, :dictionary_access => :symbol
94
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: hash, dictionary_access: :symbol
95
95
  end
96
96
 
97
97
  def test_method_access
@@ -113,7 +113,7 @@ p
113
113
  end
114
114
  end
115
115
 
116
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => object, :dictionary_access => :method
116
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: object, dictionary_access: :method
117
117
  end
118
118
 
119
119
  def test_instance_variable_access
@@ -130,7 +130,7 @@ p
130
130
  person
131
131
  end)
132
132
 
133
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => object, :dictionary_access => :instance_variable
133
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: object, dictionary_access: :instance_variable
134
134
  end
135
135
 
136
136
  def test_to_s_access
@@ -141,13 +141,13 @@ p
141
141
  }
142
142
 
143
143
  hash = {
144
- :people => [
144
+ people: [
145
145
  'Joe',
146
146
  'Jack'
147
147
  ]
148
148
  }
149
149
 
150
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => hash, :dictionary_access => :symbol
150
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: hash, dictionary_access: :symbol
151
151
  end
152
152
 
153
153
  def test_string_hash
@@ -164,7 +164,7 @@ p
164
164
  ]
165
165
  }
166
166
 
167
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => hash
167
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: hash
168
168
  end
169
169
 
170
170
  def test_dictionary_option
@@ -174,7 +174,7 @@ p
174
174
  .name = name
175
175
  }
176
176
 
177
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :scope => Scope.new, :dictionary => '@hash'
177
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, scope: Scope.new, dictionary: '@hash'
178
178
  end
179
179
 
180
180
  def test_flag_section
@@ -188,14 +188,14 @@ p
188
188
  }
189
189
 
190
190
  hash = {
191
- :show_person => true,
192
- :person => [
193
- { :name => 'Joe', },
194
- { :name => 'Jack', }
191
+ show_person: true,
192
+ person: [
193
+ { name: 'Joe', },
194
+ { name: 'Jack', }
195
195
  ]
196
196
  }
197
197
 
198
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div>shown</p>', source, :scope => hash
198
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div>shown</p>', source, scope: hash
199
199
  end
200
200
 
201
201
  def test_inverted_section
@@ -211,7 +211,7 @@ p
211
211
 
212
212
  hash = {}
213
213
 
214
- assert_html '<p>No person No person 2</p>', source, :scope => hash
214
+ assert_html '<p>No person No person 2</p>', source, scope: hash
215
215
  end
216
216
 
217
217
  def test_escaped_interpolation
@@ -232,7 +232,7 @@ p
232
232
  Person
233
233
  }
234
234
 
235
- assert_html '<p><b name="Joe">Person</b><a id="Joe">1</a><span class="Joe"><Person></Person></span><b name="Jack">Person</b><a id="Jack">2</a><span class="Jack"><Person></Person></span></p>', source, :scope => Scope.new, :dictionary => '@hash'
235
+ assert_html '<p><b name="Joe">Person</b><a id="Joe">1</a><span class="Joe"><Person></Person></span><b name="Jack">Person</b><a id="Jack">2</a><span class="Jack"><Person></Person></span></p>', source, scope: Scope.new, dictionary: '@hash'
236
236
  end
237
237
 
238
238
  def test_boolean_attributes
@@ -242,7 +242,7 @@ p
242
242
  input checked=selected = name
243
243
  }
244
244
 
245
- assert_html '<p><input checked="">Joe</input><input>Jack</input></p>', source, :scope => Scope.new, :dictionary => '@hash'
245
+ assert_html '<p><input checked="">Joe</input><input>Jack</input></p>', source, scope: Scope.new, dictionary: '@hash'
246
246
  end
247
247
 
248
248
  def test_sections
@@ -251,7 +251,7 @@ p
251
251
  - person
252
252
  .name = name
253
253
  }
254
- assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, :dictionary => 'ViewEnv.new'
254
+ assert_html '<p><div class="name">Joe</div><div class="name">Jack</div></p>', source, dictionary: 'ViewEnv.new'
255
255
  end
256
256
 
257
257
  def test_with_array
@@ -261,14 +261,14 @@ ul
261
261
  li = name
262
262
  li = city
263
263
  }
264
- assert_html '<ul><li>Andy</li><li>Atlanta</li><li>Fred</li><li>Melbourne</li><li>Daniel</li><li>Karlsruhe</li></ul>', source, :dictionary => 'ViewEnv.new'
264
+ assert_html '<ul><li>Andy</li><li>Atlanta</li><li>Fred</li><li>Melbourne</li><li>Daniel</li><li>Karlsruhe</li></ul>', source, dictionary: 'ViewEnv.new'
265
265
  end
266
266
 
267
267
  def test_method
268
268
  source = %q{
269
269
  a href=output_number Link
270
270
  }
271
- assert_html '<a href="1337">Link</a>', source, :dictionary => 'ViewEnv.new'
271
+ assert_html '<a href="1337">Link</a>', source, dictionary: 'ViewEnv.new'
272
272
  end
273
273
 
274
274
  def test_conditional_parent
@@ -279,7 +279,7 @@ a href=output_number Link
279
279
  - next_page
280
280
  li.next
281
281
  a href=next_page Newer}
282
- assert_html'<li class="previous"><a href="prev">Older</a></li><li class="next"><a href="next">Newer</a></li>', source, :scope => {:prev_page => 'prev', :next_page => 'next'}
282
+ assert_html'<li class="previous"><a href="prev">Older</a></li><li class="next"><a href="next">Newer</a></li>', source, scope: {prev_page: 'prev', next_page: 'next'}
283
283
  end
284
284
 
285
285
  def test_render_with_yield
@@ -6,7 +6,7 @@ class SlimController < ApplicationController
6
6
  end
7
7
 
8
8
  def no_layout
9
- render :layout => false
9
+ render layout: false
10
10
  end
11
11
 
12
12
  def variables
@@ -18,7 +18,7 @@ class SlimController < ApplicationController
18
18
 
19
19
  def streaming
20
20
  @hello = "Hello Streaming!"
21
- render :content_for, :stream => true
21
+ render :content_for, stream: true
22
22
  end
23
23
 
24
24
  def integers
@@ -26,7 +26,7 @@ class SlimController < ApplicationController
26
26
  end
27
27
 
28
28
  def thread_options
29
- Slim::Engine.with_options(:shortcut => {'@' => { :attr => params[:attr] }}) do
29
+ Slim::Engine.with_options(shortcut: {'@' => { attr: params[:attr] }}) do
30
30
  render
31
31
  end
32
32
  end
@@ -1,6 +1,6 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- Dummy::Application.config.session_store :cookie_store, :key => '_dummy_session'
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
4
 
5
5
  # Use the database for sessions instead of the cookie-based default,
6
6
  # which shouldn't be used to store highly confidential information
@@ -9,8 +9,8 @@ Dummy::Application.routes.draw do
9
9
  # Keep in mind you can assign values other than :controller and :action
10
10
 
11
11
  # Sample of named route:
12
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
13
- # This route can be invoked with purchase_url(:id => product.id)
12
+ # match 'products/:id/purchase' => 'catalog#purchase', as: :purchase
13
+ # This route can be invoked with purchase_url(id: product.id)
14
14
 
15
15
  # Sample resource route (maps HTTP verbs to controller actions automatically):
16
16
  # resources :products
@@ -37,7 +37,7 @@ Dummy::Application.routes.draw do
37
37
  # resources :products do
38
38
  # resources :comments
39
39
  # resources :sales do
40
- # get 'recent', :on => :collection
40
+ # get 'recent', on: :collection
41
41
  # end
42
42
  # end
43
43
 
@@ -50,7 +50,7 @@ Dummy::Application.routes.draw do
50
50
 
51
51
  # You can have the root of your site routed with "root"
52
52
  # just remember to delete public/index.html.
53
- # root :to => "welcome#index"
53
+ # root to: "welcome#index"
54
54
 
55
55
  # See how all your routes lay out with "rake routes"
56
56
 
@@ -33,7 +33,7 @@ class TestSlim < ActionDispatch::IntegrationTest
33
33
  test "view without a layout" do
34
34
  get "slim/no_layout"
35
35
  assert_template "slim/no_layout"
36
- assert_html "<h1>Hello Slim without a layout!</h1>", :skip_layout => true
36
+ assert_html "<h1>Hello Slim without a layout!</h1>", skip_layout: true
37
37
  end
38
38
 
39
39
  test "view with variables" do
@@ -46,17 +46,11 @@ class TestSlim < ActionDispatch::IntegrationTest
46
46
  assert_html "<h1>Hello Slim!</h1><p>With a partial!</p>"
47
47
  end
48
48
 
49
- #Disable streaming testing for rails 3.x and on jruby
50
- if ::Rails::VERSION::MAJOR >= 4 ||
51
- (::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1 && Object.const_defined?(:Fiber))
52
- puts 'Streaming test enabled'
53
- test "streaming" do
54
- get "slim/streaming"
55
- output = "2f\r\n<!DOCTYPE html><html><head><title>Dummy</title>\r\nd\r\n</head><body>\r\n17\r\nHeading set from a view\r\n15\r\n<div class=\"content\">\r\n53\r\n<p>Page content</p><h1><p>Hello Streaming!</p></h1><h2><p>Hello Streaming!</p></h2>\r\n14\r\n</div></body></html>\r\n0\r\n\r\n"
56
- assert_equal output, @response.body
57
- end
58
- else
59
- puts 'Streaming test disabled'
49
+ puts 'Streaming test enabled'
50
+ test "streaming" do
51
+ get "slim/streaming"
52
+ output = "2f\r\n<!DOCTYPE html><html><head><title>Dummy</title>\r\nd\r\n</head><body>\r\n17\r\nHeading set from a view\r\n15\r\n<div class=\"content\">\r\n53\r\n<p>Page content</p><h1><p>Hello Streaming!</p></h1><h2><p>Hello Streaming!</p></h2>\r\n14\r\n</div></body></html>\r\n0\r\n\r\n"
53
+ assert_equal output, @response.body
60
54
  end
61
55
 
62
56
  test "render integers" do
@@ -65,15 +59,15 @@ class TestSlim < ActionDispatch::IntegrationTest
65
59
  end
66
60
 
67
61
  test "render thread_options" do
68
- get "slim/thread_options", :attr => 'role'
62
+ get "slim/thread_options", attr: 'role'
69
63
  assert_html '<p role="empty">Test</p>'
70
- get "slim/thread_options", :attr => 'id' # Overwriting doesn't work because of caching
64
+ get "slim/thread_options", attr: 'id' # Overwriting doesn't work because of caching
71
65
  assert_html '<p role="empty">Test</p>'
72
66
  end
73
67
 
74
68
  test "content_for" do
75
69
  get "slim/content_for"
76
- assert_html "<p>Page content</p><h1><p>Hello Slim!</p></h1><h2><p>Hello Slim!</p></h2>", :heading => 'Heading set from a view'
70
+ assert_html "<p>Page content</p><h1><p>Hello Slim!</p></h1><h2><p>Hello Slim!</p></h2>", heading: 'Heading set from a view'
77
71
  end
78
72
 
79
73
  test "form_for" do
@@ -112,7 +112,7 @@ Escaped &amp;#xx; &amp;#1f; &amp;;.</p>}
112
112
  end
113
113
 
114
114
  def test_smart_text_disabled_escaping
115
- Slim::Engine.with_options( :smart_text_escaping => false ) do
115
+ Slim::Engine.with_options( smart_text_escaping: false ) do
116
116
  source = %q{
117
117
  p Not escaped <&>.
118
118
  | Not escaped <&>.
@@ -250,7 +250,7 @@ which stops
250
250
 
251
251
  assert_html result, source
252
252
  end
253
-
253
+
254
254
  # Without unicode support, we can't distinguish uppercase and lowercase
255
255
  # unicode characters reliably. So we only test the basic text, not tag names.
256
256
  def test_basic_unicode_smart_text
@@ -272,11 +272,8 @@ p
272
272
  assert_html result, source
273
273
  end
274
274
 
275
- if ''.respond_to?(:encoding)
276
-
277
- def test_unicode_smart_text
278
-
279
- source = %q{
275
+ def test_unicode_smart_text
276
+ source = %q{
280
277
  p
281
278
 
282
279
  čip
@@ -294,7 +291,6 @@ p
294
291
  šíp
295
292
  <div class="řek">.</div></p>}
296
293
 
297
- assert_html result, source
298
- end
294
+ assert_html result, source
299
295
  end
300
296
  end