Skip to content

Commit

Permalink
remove legacy code
Browse files Browse the repository at this point in the history
  • Loading branch information
minad committed Dec 3, 2014
1 parent f394ddd commit d262239
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/slim/template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ module Slim
# Disable the internal slim capturing.
# Rails takes care of the capturing by itself.
disable_capture: true,
streaming: defined?(::Fiber))
streaming: true)
end
end
6 changes: 3 additions & 3 deletions test/core/test_encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ def test_windows_crlf

def test_binary
source = "| \xFF\xFF"
source.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding
source.force_encoding(Encoding::BINARY)

result = "\xFF\xFF"
result.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding
result.force_encoding(Encoding::BINARY)

out = render(source, default_encoding: 'binary')
out.force_encoding(Encoding::BINARY) if source.respond_to? :force_encoding
out.force_encoding(Encoding::BINARY)

assert_equal result, out
end
Expand Down
24 changes: 11 additions & 13 deletions test/core/test_unicode.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# -*- coding: utf-8 -*-
if ''.respond_to?(:encoding)
require 'helper'
require 'helper'

class TestSlimUnicode < TestSlim
def test_unicode_tags
source = "Статья года"
result = "<Статья>года</Статья>"
assert_html result, source
end
class TestSlimUnicode < TestSlim
def test_unicode_tags
source = "Статья года"
result = "<Статья>года</Статья>"
assert_html result, source
end

def test_unicode_attrs
source = "Статья года=123 content"
result = "<Статья года=\"123\">content</Статья>"
assert_html result, source
end
def test_unicode_attrs
source = "Статья года=123 content"
result = "<Статья года=\"123\">content</Статья>"
assert_html result, source
end
end
16 changes: 5 additions & 11 deletions test/rails/test/test_slim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,11 @@ class TestSlim < ActionDispatch::IntegrationTest
assert_html "<h1>Hello Slim!</h1><p>With a partial!</p>"
end

#Disable streaming testing for rails 3.x and on jruby
if ::Rails::VERSION::MAJOR >= 4 ||
(::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR >= 1 && Object.const_defined?(:Fiber))
puts 'Streaming test enabled'
test "streaming" do
get "slim/streaming"
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"
assert_equal output, @response.body
end
else
puts 'Streaming test disabled'
puts 'Streaming test enabled'
test "streaming" do
get "slim/streaming"
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"
assert_equal output, @response.body
end

test "render integers" do
Expand Down
12 changes: 4 additions & 8 deletions test/smart/test_smart_text.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def test_smart_text_mixed_with_code

assert_html result, source
end

# Without unicode support, we can't distinguish uppercase and lowercase
# unicode characters reliably. So we only test the basic text, not tag names.
def test_basic_unicode_smart_text
Expand All @@ -272,11 +272,8 @@ def test_basic_unicode_smart_text
assert_html result, source
end

if ''.respond_to?(:encoding)

def test_unicode_smart_text

source = %q{
def test_unicode_smart_text
source = %q{
p
čip
Expand All @@ -294,7 +291,6 @@ def test_unicode_smart_text
šíp
<div class="řek">.</div></p>}

assert_html result, source
end
assert_html result, source
end
end

0 comments on commit d262239

Please sign in to comment.