From a4dc2ea93c61aa59155b26b90daf7b29ca382e0c Mon Sep 17 00:00:00 2001 From: Kashyap Date: Thu, 29 Oct 2015 18:11:31 +0530 Subject: [PATCH] Revert 855208a2936b27da68588ba547b3fb70c3e48268. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This causes conflicts with the way the instance variable `@file` in the test file works with the scope of `mock_app`. Without assigning the `@file` instance variable to a temporary variable—in this case `path`—we won't be able to access the instance var inside the mock_app > get context. --- test/helpers_test.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/helpers_test.rb b/test/helpers_test.rb index 38f645f8..f56fe24c 100644 --- a/test/helpers_test.rb +++ b/test/helpers_test.rb @@ -778,9 +778,10 @@ class HelpersTest < Minitest::Test end def send_file_app(opts={}) + path = @file mock_app { get '/file.txt' do - send_file @file, opts + send_file path, opts end } end @@ -882,10 +883,11 @@ class HelpersTest < Minitest::Test end it "does not override Content-Type if already set and no explicit type is given" do + path = @file mock_app do get('/') do content_type :png - send_file @file + send_file path end end get '/' @@ -893,10 +895,11 @@ class HelpersTest < Minitest::Test end it "does override Content-Type even if already set, if explicit type is given" do + path = @file mock_app do get('/') do content_type :png - send_file @file, :type => :gif + send_file path, :type => :gif end end get '/' @@ -904,9 +907,10 @@ class HelpersTest < Minitest::Test end it 'can have :status option as a string' do + path = @file mock_app do post '/' do - send_file @file, :status => '422' + send_file path, :status => '422' end end post '/'