slim 2.1.0 → 3.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +10 -24
- data/CHANGES +8 -0
- data/Gemfile +5 -7
- data/README.jp.md +29 -31
- data/README.md +34 -34
- data/Rakefile +9 -7
- data/benchmarks/context.rb +3 -3
- data/benchmarks/run-benchmarks.rb +9 -9
- data/benchmarks/view.slim +1 -1
- data/doc/jp/logic_less.md +7 -7
- data/doc/logic_less.md +7 -7
- data/lib/slim/command.rb +6 -16
- data/lib/slim/embedded.rb +10 -13
- data/lib/slim/engine.rb +21 -23
- data/lib/slim/erb_converter.rb +2 -1
- data/lib/slim/include.rb +2 -2
- data/lib/slim/logic_less.rb +1 -2
- data/lib/slim/logic_less/filter.rb +3 -3
- data/lib/slim/parser.rb +43 -19
- data/lib/slim/smart.rb +3 -3
- data/lib/slim/smart/escaper.rb +1 -1
- data/lib/slim/smart/filter.rb +3 -3
- data/lib/slim/smart/parser.rb +6 -4
- data/lib/slim/splat/builder.rb +9 -4
- data/lib/slim/splat/filter.rb +3 -4
- data/lib/slim/template.rb +5 -5
- data/lib/slim/translator.rb +12 -13
- data/lib/slim/version.rb +1 -1
- data/slim.gemspec +3 -1
- data/test/core/helper.rb +3 -3
- data/test/core/test_code_escaping.rb +14 -14
- data/test/core/test_code_evaluation.rb +1 -1
- data/test/core/test_code_output.rb +1 -1
- data/test/core/test_embedded_engines.rb +16 -16
- data/test/core/test_encoding.rb +4 -4
- data/test/core/test_html_attributes.rb +9 -9
- data/test/core/test_html_structure.rb +20 -20
- data/test/core/test_parser_errors.rb +1 -1
- data/test/core/test_pretty.rb +4 -4
- data/test/core/test_ruby_errors.rb +5 -5
- data/test/core/test_slim_template.rb +2 -2
- data/test/core/test_tabs.rb +5 -5
- data/test/core/test_thread_options.rb +4 -4
- data/test/core/test_unicode.rb +11 -13
- data/test/include/test_include.rb +2 -2
- data/test/literate/TESTS.md +37 -8
- data/test/literate/helper.rb +2 -2
- data/test/logic_less/test_logic_less.rb +37 -37
- data/test/rails/app/controllers/slim_controller.rb +3 -3
- data/test/rails/config/initializers/session_store.rb +1 -1
- data/test/rails/config/routes.rb +4 -4
- data/test/rails/test/test_slim.rb +9 -15
- data/test/smart/test_smart_text.rb +5 -9
- data/test/translator/test_translator.rb +14 -14
- metadata +7 -7
data/lib/slim/smart.rb
CHANGED
@@ -3,6 +3,6 @@ require 'slim/smart/filter'
|
|
3
3
|
require 'slim/smart/escaper'
|
4
4
|
require 'slim/smart/parser'
|
5
5
|
|
6
|
-
Slim::Engine.replace
|
7
|
-
Slim::Engine.after
|
8
|
-
Slim::Engine.after
|
6
|
+
Slim::Engine.replace Slim::Parser, Slim::Smart::Parser
|
7
|
+
Slim::Engine.after Slim::Smart::Parser, Slim::Smart::Filter
|
8
|
+
Slim::Engine.after Slim::Interpolation, Slim::Smart::Escaper
|
data/lib/slim/smart/escaper.rb
CHANGED
data/lib/slim/smart/filter.rb
CHANGED
@@ -5,9 +5,9 @@ module Slim
|
|
5
5
|
#
|
6
6
|
# @api private
|
7
7
|
class Filter < ::Slim::Filter
|
8
|
-
define_options :
|
9
|
-
:
|
10
|
-
:
|
8
|
+
define_options smart_text: true,
|
9
|
+
smart_text_end_chars: '([{',
|
10
|
+
smart_text_begin_chars: ',.;:!?)]}'
|
11
11
|
|
12
12
|
def initialize(opts = {})
|
13
13
|
super
|
data/lib/slim/smart/parser.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
1
3
|
module Slim
|
2
4
|
module Smart
|
3
5
|
class Parser < ::Slim::Parser
|
4
|
-
define_options :
|
6
|
+
define_options implicit_text: true
|
5
7
|
|
6
8
|
def initialize(opts = {})
|
7
9
|
super
|
8
|
-
word_re = options[:implicit_text] ?
|
10
|
+
word_re = options[:implicit_text] ? '[_a-z0-9]' : '\p{Word}'
|
9
11
|
attr_keys = Regexp.union(@attr_shortcut.keys.sort_by {|k| -k.size } )
|
10
|
-
@attr_shortcut_re = /\A(#{attr_keys}+)((
|
12
|
+
@attr_shortcut_re = /\A(#{attr_keys}+)((?:\p{Word}|-)*)/
|
11
13
|
tag_keys = Regexp.union((@tag_shortcut.keys - @attr_shortcut.keys).sort_by {|k| -k.size } )
|
12
|
-
@tag_re = /\A(?:#{attr_keys}(
|
14
|
+
@tag_re = /\A(?:#{attr_keys}(?=-*\p{Word})|#{tag_keys}|\*(?=[^\s]+)|(#{word_re}(?:#{word_re}|:|-)*#{word_re}|#{word_re}+))/
|
13
15
|
end
|
14
16
|
|
15
17
|
def unknown_line_indicator
|
data/lib/slim/splat/builder.rb
CHANGED
@@ -10,11 +10,11 @@ module Slim
|
|
10
10
|
def code_attr(name, escape, value)
|
11
11
|
if delim = @options[:merge_attrs][name]
|
12
12
|
value = Array === value ? value.join(delim) : value.to_s
|
13
|
-
attr(name, escape
|
13
|
+
attr(name, escape_html(escape, value)) unless value.empty?
|
14
14
|
elsif @options[:hyphen_attrs].include?(name) && Hash === value
|
15
15
|
hyphen_attr(name, escape, value)
|
16
16
|
elsif value != false && value != nil
|
17
|
-
attr(name, value != true && escape
|
17
|
+
attr(name, escape_html(value != true && escape, value))
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -27,7 +27,7 @@ module Slim
|
|
27
27
|
def attr(name, value)
|
28
28
|
if @attrs[name]
|
29
29
|
if delim = @options[:merge_attrs][name]
|
30
|
-
@attrs[name]
|
30
|
+
@attrs[name] += delim + value.to_s
|
31
31
|
else
|
32
32
|
raise("Multiple #{name} attributes specified")
|
33
33
|
end
|
@@ -69,9 +69,14 @@ module Slim
|
|
69
69
|
hyphen_attr("#{name}-#{n.to_s.gsub('_', '-')}", escape, v)
|
70
70
|
end
|
71
71
|
else
|
72
|
-
attr(name, value != true && escape
|
72
|
+
attr(name, escape_html(value != true && escape, value))
|
73
73
|
end
|
74
74
|
end
|
75
|
+
|
76
|
+
def escape_html(escape, value)
|
77
|
+
return value unless escape
|
78
|
+
@options[:use_html_safe] ? Temple::Utils.escape_html_safe(value) : Temple::Utils.escape_html(value)
|
79
|
+
end
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
data/lib/slim/splat/filter.rb
CHANGED
@@ -2,15 +2,14 @@ module Slim
|
|
2
2
|
module Splat
|
3
3
|
# @api private
|
4
4
|
class Filter < ::Slim::Filter
|
5
|
-
|
6
|
-
|
7
|
-
set_default_options :hyphen_attrs => %w(data aria), :use_html_safe => ''.respond_to?(:html_safe?)
|
5
|
+
define_options :merge_attrs, :attr_quote, :sort_attrs, :default_tag, :format,
|
6
|
+
hyphen_attrs: %w(data aria), use_html_safe: ''.respond_to?(:html_safe?)
|
8
7
|
|
9
8
|
def call(exp)
|
10
9
|
@splat_options = nil
|
11
10
|
exp = compile(exp)
|
12
11
|
if @splat_options
|
13
|
-
opts = options.to_hash.reject {|k,v| !
|
12
|
+
opts = options.to_hash.reject {|k,v| !Filter.options.valid_key?(k) }.inspect
|
14
13
|
[:multi, [:code, "#{@splat_options} = #{opts}"], exp]
|
15
14
|
else
|
16
15
|
exp
|
data/lib/slim/template.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
module Slim
|
2
2
|
# Tilt template implementation for Slim
|
3
3
|
# @api public
|
4
|
-
Template = Temple::Templates::Tilt(Slim::Engine, :
|
4
|
+
Template = Temple::Templates::Tilt(Slim::Engine, register_as: :slim)
|
5
5
|
|
6
6
|
if defined?(::ActionView)
|
7
7
|
# Rails template implementation for Slim
|
8
8
|
# @api public
|
9
9
|
RailsTemplate = Temple::Templates::Rails(Slim::Engine,
|
10
|
-
:
|
10
|
+
register_as: :slim,
|
11
11
|
# Use rails-specific generator. This is necessary
|
12
12
|
# to support block capturing and streaming.
|
13
|
-
:
|
13
|
+
generator: Temple::Generators::RailsOutputBuffer,
|
14
14
|
# Disable the internal slim capturing.
|
15
15
|
# Rails takes care of the capturing by itself.
|
16
|
-
:
|
17
|
-
:
|
16
|
+
disable_capture: true,
|
17
|
+
streaming: true)
|
18
18
|
end
|
19
19
|
end
|
data/lib/slim/translator.rb
CHANGED
@@ -2,19 +2,19 @@ require 'slim'
|
|
2
2
|
|
3
3
|
module Slim
|
4
4
|
class Translator < Filter
|
5
|
-
define_options :
|
6
|
-
:
|
7
|
-
:
|
5
|
+
define_options :tr,
|
6
|
+
tr_mode: :dynamic,
|
7
|
+
tr_fn: '_'
|
8
8
|
|
9
9
|
if defined?(::I18n)
|
10
|
-
|
11
|
-
|
10
|
+
set_options tr_fn: '::Slim::Translator.i18n_text',
|
11
|
+
tr: true
|
12
12
|
elsif defined?(::GetText)
|
13
|
-
|
14
|
-
|
13
|
+
set_options tr_fn: '::GetText._',
|
14
|
+
tr: true
|
15
15
|
elsif defined?(::FastGettext)
|
16
|
-
|
17
|
-
|
16
|
+
set_options tr_fn: '::FastGettext::Translation._',
|
17
|
+
tr: true
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.i18n_text(text)
|
@@ -38,9 +38,9 @@ module Slim
|
|
38
38
|
super
|
39
39
|
case options[:tr_mode]
|
40
40
|
when :static
|
41
|
-
@translator = StaticTranslator.new(:
|
41
|
+
@translator = StaticTranslator.new(tr_fn: options[:tr_fn])
|
42
42
|
when :dynamic
|
43
|
-
@translator = DynamicTranslator.new(:
|
43
|
+
@translator = DynamicTranslator.new(tr_fn: options[:tr_fn])
|
44
44
|
else
|
45
45
|
raise ArgumentError, "Invalid translator mode #{options[:tr_mode].inspect}"
|
46
46
|
end
|
@@ -114,5 +114,4 @@ module Slim
|
|
114
114
|
end
|
115
115
|
end
|
116
116
|
|
117
|
-
|
118
|
-
Slim::Engine.before(Slim::EndInserter, Slim::Translator, :tr, :tr_fn, :tr_mode)
|
117
|
+
Slim::Engine.before Slim::EndInserter, Slim::Translator
|
data/lib/slim/version.rb
CHANGED
data/slim.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
19
|
s.require_paths = %w(lib)
|
20
20
|
|
21
|
-
s.
|
21
|
+
s.required_ruby_version = '>=1.9.2'
|
22
|
+
|
23
|
+
s.add_runtime_dependency('temple', ['~> 0.7.1'])
|
22
24
|
s.add_runtime_dependency('tilt', ['>= 1.3.3', '< 2.1'])
|
23
25
|
end
|
data/test/core/helper.rb
CHANGED
@@ -4,7 +4,7 @@ require 'minitest/autorun'
|
|
4
4
|
require 'slim'
|
5
5
|
require 'slim/grammar'
|
6
6
|
|
7
|
-
Slim::Engine.after Slim::Parser, Temple::Filters::Validator, :
|
7
|
+
Slim::Engine.after Slim::Parser, Temple::Filters::Validator, grammar: Slim::Grammar
|
8
8
|
Slim::Engine.before :Pretty, Temple::Filters::Validator
|
9
9
|
|
10
10
|
class TestSlim < MiniTest::Unit::TestCase
|
@@ -99,7 +99,7 @@ class Env
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def hash
|
102
|
-
{:
|
102
|
+
{a: 'The letter a', b: 'The letter b'}
|
103
103
|
end
|
104
104
|
|
105
105
|
def show_first?(show = false)
|
@@ -157,7 +157,7 @@ class ViewEnv
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def person
|
160
|
-
[{:
|
160
|
+
[{name: 'Joe'}, {name: 'Jack'}]
|
161
161
|
end
|
162
162
|
|
163
163
|
def people
|
@@ -31,7 +31,7 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>."
|
|
31
31
|
}
|
32
32
|
|
33
33
|
with_html_safe do
|
34
|
-
assert_html "<p><strong>Hello World\n, meet \"Slim\"</strong>.</p>", source, :
|
34
|
+
assert_html "<p><strong>Hello World\n, meet \"Slim\"</strong>.</p>", source, use_html_safe: true
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
@@ -41,27 +41,27 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>.".html_safe
|
|
41
41
|
}
|
42
42
|
|
43
43
|
with_html_safe do
|
44
|
-
assert_html "<p><strong>Hello World\n, meet \"Slim\"</strong>.</p>", source, :
|
44
|
+
assert_html "<p><strong>Hello World\n, meet \"Slim\"</strong>.</p>", source, use_html_safe: true
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_render_splat_with_html_safe_true
|
49
49
|
source = %q{
|
50
|
-
p *{ :
|
50
|
+
p *{ title: '&'.html_safe }
|
51
51
|
}
|
52
52
|
|
53
53
|
with_html_safe do
|
54
|
-
assert_html "<p title=\"&\"></p>", source, :
|
54
|
+
assert_html "<p title=\"&\"></p>", source, use_html_safe: true
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
def test_render_splat_with_html_safe_false
|
59
59
|
source = %q{
|
60
|
-
p *{ :
|
60
|
+
p *{ title: '&' }
|
61
61
|
}
|
62
62
|
|
63
63
|
with_html_safe do
|
64
|
-
assert_html "<p title=\"&\"></p>", source, :
|
64
|
+
assert_html "<p title=\"&\"></p>", source, use_html_safe: true
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
@@ -72,7 +72,7 @@ p title=('&'.html_safe)
|
|
72
72
|
}
|
73
73
|
|
74
74
|
with_html_safe do
|
75
|
-
assert_html "<p title=\"&\"></p>", source, :
|
75
|
+
assert_html "<p title=\"&\"></p>", source, use_html_safe: true
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
@@ -91,7 +91,7 @@ p title=('&'.html_safe)
|
|
91
91
|
== "<p>World</p>"
|
92
92
|
}
|
93
93
|
|
94
|
-
assert_html "<p>Hello</p><p>World</p>", source, :
|
94
|
+
assert_html "<p>Hello</p><p>World</p>", source, disable_escape: true
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_escaping_evil_method_with_pretty
|
@@ -99,7 +99,7 @@ p title=('&'.html_safe)
|
|
99
99
|
p = evil_method
|
100
100
|
}
|
101
101
|
|
102
|
-
assert_html "<p>\n <script>do_something_evil();</script>\n</p>", source, :
|
102
|
+
assert_html "<p>\n <script>do_something_evil();</script>\n</p>", source, pretty: true
|
103
103
|
end
|
104
104
|
|
105
105
|
def test_render_without_html_safe_with_pretty
|
@@ -107,7 +107,7 @@ p = evil_method
|
|
107
107
|
p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>."
|
108
108
|
}
|
109
109
|
|
110
|
-
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, :
|
110
|
+
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, pretty: true
|
111
111
|
end
|
112
112
|
|
113
113
|
def test_render_with_html_safe_false_with_pretty
|
@@ -116,7 +116,7 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>."
|
|
116
116
|
}
|
117
117
|
|
118
118
|
with_html_safe do
|
119
|
-
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, :
|
119
|
+
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, use_html_safe: true, pretty: true
|
120
120
|
end
|
121
121
|
end
|
122
122
|
|
@@ -126,7 +126,7 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>.".html_safe
|
|
126
126
|
}
|
127
127
|
|
128
128
|
with_html_safe do
|
129
|
-
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, :
|
129
|
+
assert_html "<p>\n <strong>Hello World\n , meet \"Slim\"</strong>.\n</p>", source, use_html_safe: true, pretty: true
|
130
130
|
end
|
131
131
|
end
|
132
132
|
|
@@ -136,7 +136,7 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>.".html_safe
|
|
136
136
|
== "<p>World</p>"
|
137
137
|
}
|
138
138
|
|
139
|
-
assert_html "<p>Hello</p><p>World</p>", source, :
|
139
|
+
assert_html "<p>Hello</p><p>World</p>", source, pretty: true
|
140
140
|
end
|
141
141
|
|
142
142
|
def test_render_with_disable_escape_true_with_pretty
|
@@ -145,6 +145,6 @@ p = "<strong>Hello World\\n, meet \\"Slim\\"</strong>.".html_safe
|
|
145
145
|
== "<p>World</p>"
|
146
146
|
}
|
147
147
|
|
148
|
-
assert_html "<p>Hello</p><p>World</p>", source, :
|
148
|
+
assert_html "<p>Hello</p><p>World</p>", source, disable_escape: true, pretty: true
|
149
149
|
end
|
150
150
|
end
|
@@ -44,7 +44,7 @@ p id="#{id_helper}" class="hello world" = hello_world "Hello Ruby!"
|
|
44
44
|
|
45
45
|
def test_render_with_spaced_parameterized_call_to_set_attributes_and_call_to_set_content_2
|
46
46
|
source = %q{
|
47
|
-
p id="#{id_helper}" class="hello world" = hello_world "Hello Ruby!", :
|
47
|
+
p id="#{id_helper}" class="hello world" = hello_world "Hello Ruby!", dummy: "value"
|
48
48
|
}
|
49
49
|
|
50
50
|
assert_html '<p class="hello world" id="notice">Hello Ruby!dummy value</p>', source
|
@@ -52,7 +52,7 @@ markdown:
|
|
52
52
|
# kramdown, :auto_ids by default
|
53
53
|
assert_html "<h1 id=\"header\">Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source
|
54
54
|
|
55
|
-
Slim::Embedded.with_options(:
|
55
|
+
Slim::Embedded.with_options(markdown: {auto_ids: false}) do
|
56
56
|
assert_html "<h1>Header</h1>\n<p>Hello from Markdown!</p>\n\n<p>3</p>\n\n<ul>\n <li>one</li>\n <li>two</li>\n</ul>\n", source
|
57
57
|
end
|
58
58
|
|
@@ -95,7 +95,7 @@ org:
|
|
95
95
|
def test_render_with_builder
|
96
96
|
source = %q{
|
97
97
|
builder:
|
98
|
-
xml.p(:
|
98
|
+
xml.p(id: 'test') {
|
99
99
|
xml.text!('Hello')
|
100
100
|
}
|
101
101
|
}
|
@@ -155,28 +155,28 @@ javascript:
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def test_render_with_javascript_with_explicit_html_comment
|
158
|
-
Slim::Engine.with_options(:
|
158
|
+
Slim::Engine.with_options(js_wrapper: :comment) do
|
159
159
|
source = "javascript:\n\t$(function() {});\n\talert('hello')\np Hi"
|
160
160
|
assert_html "<script type=\"text/javascript\"><!--\n$(function() {});\nalert('hello')\n//--></script><p>Hi</p>", source
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
164
164
|
def test_render_with_javascript_with_explicit_cdata_comment
|
165
|
-
Slim::Engine.with_options(:
|
165
|
+
Slim::Engine.with_options(js_wrapper: :cdata) do
|
166
166
|
source = "javascript:\n\t$(function() {});\n\talert('hello')\np Hi"
|
167
167
|
assert_html "<script type=\"text/javascript\">\n//<![CDATA[\n$(function() {});\nalert('hello')\n//]]>\n</script><p>Hi</p>", source
|
168
168
|
end
|
169
169
|
end
|
170
170
|
|
171
171
|
def test_render_with_javascript_with_format_xhtml_comment
|
172
|
-
Slim::Engine.with_options(:
|
172
|
+
Slim::Engine.with_options(js_wrapper: :guess, format: :xhtml) do
|
173
173
|
source = "javascript:\n\t$(function() {});\n\talert('hello')\np Hi"
|
174
174
|
assert_html "<script type=\"text/javascript\">\n//<![CDATA[\n$(function() {});\nalert('hello')\n//]]>\n</script><p>Hi</p>", source
|
175
175
|
end
|
176
176
|
end
|
177
177
|
|
178
178
|
def test_render_with_javascript_with_format_html_comment
|
179
|
-
Slim::Engine.with_options(:
|
179
|
+
Slim::Engine.with_options(js_wrapper: :guess, format: :html) do
|
180
180
|
source = "javascript:\n\t$(function() {});\n\talert('hello')\np Hi"
|
181
181
|
assert_html "<script type=\"text/javascript\"><!--\n$(function() {});\nalert('hello')\n//--></script><p>Hi</p>", source
|
182
182
|
end
|
@@ -206,22 +206,22 @@ scss:
|
|
206
206
|
ruby:
|
207
207
|
Embedded Ruby
|
208
208
|
}
|
209
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
210
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
209
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, enable_engines: [:javascript]
|
210
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, enable_engines: %w(javascript)
|
211
211
|
|
212
212
|
source = %{
|
213
213
|
ruby:
|
214
214
|
Embedded Ruby
|
215
215
|
}
|
216
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
217
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
216
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, enable_engines: [:javascript]
|
217
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, enable_engines: %w(javascript)
|
218
218
|
|
219
219
|
source = %{
|
220
220
|
ruby:
|
221
221
|
Embedded Ruby
|
222
222
|
}
|
223
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
224
|
-
assert_runtime_error 'Embedded engine ruby is disabled', source, :
|
223
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, disable_engines: [:ruby]
|
224
|
+
assert_runtime_error 'Embedded engine ruby is disabled', source, disable_engines: %w(ruby)
|
225
225
|
end
|
226
226
|
|
227
227
|
def test_enabled_embedded_engine
|
@@ -229,14 +229,14 @@ ruby:
|
|
229
229
|
javascript:
|
230
230
|
$(function() {});
|
231
231
|
}
|
232
|
-
assert_html '<script type="text/javascript">$(function() {});</script>', source, :
|
233
|
-
assert_html '<script type="text/javascript">$(function() {});</script>', source, :
|
232
|
+
assert_html '<script type="text/javascript">$(function() {});</script>', source, disable_engines: [:ruby]
|
233
|
+
assert_html '<script type="text/javascript">$(function() {});</script>', source, disable_engines: %w(ruby)
|
234
234
|
|
235
235
|
source = %q{
|
236
236
|
javascript:
|
237
237
|
$(function() {});
|
238
238
|
}
|
239
|
-
assert_html '<script type="text/javascript">$(function() {});</script>', source, :
|
240
|
-
assert_html '<script type="text/javascript">$(function() {});</script>', source, :
|
239
|
+
assert_html '<script type="text/javascript">$(function() {});</script>', source, enable_engines: [:javascript]
|
240
|
+
assert_html '<script type="text/javascript">$(function() {});</script>', source, enable_engines: %w(javascript)
|
241
241
|
end
|
242
242
|
end
|