Sha256: 7730fe997d37e87d622b4787096dda1fae893a16fd6eae6ce1267ce728f77b11
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true RSpec.describe "Unsafe send file", type: :integration do it "sends file from the public directory" do with_project do write "public/static.txt", "Static file" generate "action web home#index --url=/" rewrite "apps/web/controllers/home/index.rb", <<~EOF module Web::Controllers::Home class Index include Web::Action def call(params) unsafe_send_file "public/static.txt" end end end EOF server do get "/" expect(last_response.status).to eq(200) expect(last_response.body).to include("Static file") end end end it "sends file outside of the public directory" do with_project do generate "action web home#index --url=/" rewrite "apps/web/controllers/home/index.rb", <<~EOF module Web::Controllers::Home class Index include Web::Action def call(params) unsafe_send_file __FILE__ end end end EOF server do get "/" expect(last_response.status).to eq(200) expect(last_response.body).to include("Web::Controllers::Home") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta2 | spec/integration/unsafe_send_file_spec.rb |
hanami-2.0.0.beta1.1 | spec/integration/unsafe_send_file_spec.rb |
hanami-2.0.0.beta1 | spec/integration/unsafe_send_file_spec.rb |