Sha256: 0a9bc75de0a8ee4c5e0371fa4b18d95e36e1008407e716ab52c551ec14d0f900
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 KB
Contents
# frozen_string_literal: true RSpec.describe "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) send_file "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 "doesn't send file outside of 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) send_file __FILE__ end end end EOF server do get "/" expect(last_response.status).to eq(404) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.beta2 | spec/integration/send_file_spec.rb |
hanami-2.0.0.beta1.1 | spec/integration/send_file_spec.rb |
hanami-2.0.0.beta1 | spec/integration/send_file_spec.rb |