Skip to content

Commit 0135c85

Browse files
committed
1 parent 6f48788 commit 0135c85

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ gem 'commonmarker', '~> 0.23.4', platforms: [:ruby]
4141
gem 'erubi'
4242
gem 'eventmachine'
4343
gem 'falcon', '~> 0.40', platforms: [:ruby]
44-
gem 'haml', '~> 6'
44+
gem 'haml'
4545
gem 'kramdown'
4646
gem 'liquid'
4747
gem 'markaby'

sinatra-contrib/spec/haml_helpers_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'sinatra/haml_helpers'
44

55
RSpec.describe Sinatra::HamlHelpers do
6+
let(:quote_char) { Haml::VERSION >= "7.0.0" ? "\"" : "'" }
7+
68
describe "#surround" do
79
it "renders correctly" do
810
mock_app do
@@ -20,7 +22,7 @@
2022
get "/"
2123
html_code = <<~HTML
2224
<p>
23-
(<a href='https://example.org/'>surrounded</a>)
25+
(<a href=#{quote_char}https://example.org/#{quote_char}>surrounded</a>)
2426
</p>
2527
HTML
2628
expect(body).to eq(html_code)
@@ -44,7 +46,7 @@
4446
get "/"
4547
html_code = <<~HTML
4648
<p>
47-
* <a href='https://example.org/'>preceded</a>
49+
* <a href=#{quote_char}https://example.org/#{quote_char}>preceded</a>
4850
</p>
4951
HTML
5052
expect(body).to eq(html_code)
@@ -68,7 +70,7 @@
6870
get "/"
6971
html_code = <<~HTML
7072
<p>
71-
<a href='https://example.org/'>succeeded</a>.
73+
<a href=#{quote_char}https://example.org/#{quote_char}>succeeded</a>.
7274
</p>
7375
HTML
7476
expect(body).to eq(html_code)

test/haml_test.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def haml_app(&block)
6565
end
6666

6767
it "merges the default HAML options with the overrides and passes them to the Haml engine" do
68+
quote_char = Haml::VERSION >= "7.0.0" ? "\"" : "'"
6869
mock_app do
6970
set :haml, {:format => :html5}
7071
get('/') { haml "!!!\n%h1{:class => :header} Hello World" }
@@ -74,7 +75,7 @@ def haml_app(&block)
7475
end
7576
get '/'
7677
assert ok?
77-
assert_equal "<!DOCTYPE html>\n<h1 class='header'>Hello World</h1>\n", body
78+
assert_equal "<!DOCTYPE html>\n<h1 class=#{quote_char}header#{quote_char}>Hello World</h1>\n", body
7879
get '/html4'
7980
assert ok?
8081
assert_match(/^<!DOCTYPE html PUBLIC (.*) HTML 4.01/, body)

0 commit comments

Comments
 (0)