commit
62b17d38ad
5 changed files with 33 additions and 5 deletions
23
middleman-core/features/encoding_option.feature
Normal file
23
middleman-core/features/encoding_option.feature
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
# encoding: iso-8859-1
|
||||||
|
Feature: encoding option
|
||||||
|
|
||||||
|
Scenario: No encoding set
|
||||||
|
Given a fixture app "clean-app"
|
||||||
|
Given the Server is running at "clean-app"
|
||||||
|
|
||||||
|
When I go to "/index.html"
|
||||||
|
Then the "Content-Type" header should contain "text/html"
|
||||||
|
Then the "Content-Type" header should contain "charset=utf-8"
|
||||||
|
|
||||||
|
Scenario: Custom encoding set
|
||||||
|
Given a fixture app "i-8859-1-app"
|
||||||
|
And a file named "config.rb" with:
|
||||||
|
"""
|
||||||
|
set :encoding, "ISO-8859-1"
|
||||||
|
"""
|
||||||
|
Given the Server is running at "i-8859-1-app"
|
||||||
|
|
||||||
|
When I go to "/index.html"
|
||||||
|
Then the "Content-Type" header should contain "text/html"
|
||||||
|
Then the "Content-Type" header should contain "charset=iso-8859-1"
|
||||||
|
Then I should see "äöü"
|
1
middleman-core/fixtures/i-8859-1-app/config.rb
Normal file
1
middleman-core/fixtures/i-8859-1-app/config.rb
Normal file
|
@ -0,0 +1 @@
|
||||||
|
set :encoding, "ISO-8859-1"
|
|
@ -0,0 +1 @@
|
||||||
|
<EFBFBD><EFBFBD><EFBFBD>
|
|
@ -253,11 +253,6 @@ module Middleman
|
||||||
# Initialize the Sitemap
|
# Initialize the Sitemap
|
||||||
@sitemap = ::Middleman::Sitemap::Store.new(self)
|
@sitemap = ::Middleman::Sitemap::Store.new(self)
|
||||||
|
|
||||||
if Object.const_defined?(:Encoding)
|
|
||||||
Encoding.default_internal = config[:encoding]
|
|
||||||
Encoding.default_external = config[:encoding]
|
|
||||||
end
|
|
||||||
|
|
||||||
::Middleman::Extension.clear_after_extension_callbacks
|
::Middleman::Extension.clear_after_extension_callbacks
|
||||||
|
|
||||||
after_configuration_eval(&method(:prune_tilt_templates))
|
after_configuration_eval(&method(:prune_tilt_templates))
|
||||||
|
@ -276,6 +271,10 @@ module Middleman
|
||||||
# Eval config.
|
# Eval config.
|
||||||
evaluate_configuration!
|
evaluate_configuration!
|
||||||
|
|
||||||
|
if Object.const_defined?(:Encoding)
|
||||||
|
Encoding.default_external = config[:encoding]
|
||||||
|
end
|
||||||
|
|
||||||
# Run any `configure` blocks for the current environment.
|
# Run any `configure` blocks for the current environment.
|
||||||
execute_callbacks([:configure, config[:environment]])
|
execute_callbacks([:configure, config[:environment]])
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,10 @@ Then /^the content type should be "([^\"]*)"$/ do |expected|
|
||||||
expect(page.response_headers['Content-Type']).to start_with expected
|
expect(page.response_headers['Content-Type']).to start_with expected
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the "([^\"]*)" header should contain "([^\"]*)"$/ do |header, expected|
|
||||||
|
expect(page.response_headers[header]).to include expected
|
||||||
|
end
|
||||||
|
|
||||||
Then /^I should see "([^\"]*)"$/ do |expected|
|
Then /^I should see "([^\"]*)"$/ do |expected|
|
||||||
expect(page.body).to include expected
|
expect(page.body).to include expected
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue