summaryrefslogtreecommitdiff
path: root/test/spec_builder.rb
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2020-02-03 00:01:56 +0100
committerSamuel Williams <samuel.williams@oriontransfer.co.nz>2020-02-03 12:12:41 +1300
commite3fd0c4e23608a27e7e8a1bcddb8cf59238ae0d8 (patch)
tree3fc8a5f6d9f24e21552566b3b2faa6ee555c967c /test/spec_builder.rb
parentf2d2df4016a906beec755b63b4edfcc07b58ee05 (diff)
downloadrack-e3fd0c4e23608a27e7e8a1bcddb8cf59238ae0d8.tar.gz
Support magic comments in .ru files
* Such as # frozen_string_literal: true.
Diffstat (limited to 'test/spec_builder.rb')
-rw-r--r--test/spec_builder.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/spec_builder.rb b/test/spec_builder.rb
index 424e3314..c0f59c18 100644
--- a/test/spec_builder.rb
+++ b/test/spec_builder.rb
@@ -270,6 +270,15 @@ describe Rack::Builder do
Encoding.default_external = enc
end
end
+
+ it "respects the frozen_string_literal magic comment" do
+ app, _ = Rack::Builder.parse_file(config_file('frozen.ru'))
+ response = Rack::MockRequest.new(app).get('/')
+ response.body.must_equal 'frozen'
+ body = response.instance_variable_get(:@body)
+ body.must_equal(['frozen'])
+ body[0].frozen?.must_equal true
+ end
end
describe 'new_from_string' do