Sha256: 80843fa20f9312940013205576e82ab20d36e88f62af7e8e60093bda9828f6c8

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

RSpec.describe "assets", type: :integration do
  describe "fingerprint mode" do
    it "servers assets with fingerprint url" do
      with_project do
        generate "action web home#index --url=/"

        write "apps/web/assets/javascripts/app.css", <<~EOF
          body { color: #333 };
        EOF
        rewrite "apps/web/templates/app.html.erb", <<~EOF
          <!DOCTYPE html>
          <html>
            <head>
              <title>Web</title>
              <%= favicon %>
              <%= stylesheet 'app' %>
            </head>
            <body>
              <%= yield %>
            </body>
          </html>
        EOF
        #
        # Precompile
        #
        RSpec::Support::Env["HANAMI_ENV"]   = "production"
        RSpec::Support::Env["DATABASE_URL"] = "sqlite://#{Pathname.new('db').join('bookshelf.sqlite')}"
        RSpec::Support::Env["SMTP_HOST"]    = "localhost"
        RSpec::Support::Env["SMTP_PORT"]    = "25"
        hanami "assets precompile"

        server do
          visit "/"

          expect(page.body).to include(%(<link href="/assets/app-5df86b4e9cbd733a027762b2f6bf8693.css" type="text/css" rel="stylesheet" integrity="sha256-LxaTcWkL8TAWFQWeHJ7OqoSoEXXaYapNIS+TCvGNf48=" crossorigin="anonymous">))
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hanami-2.0.0.beta2 spec/integration/assets/fingerprint_spec.rb
hanami-2.0.0.beta1.1 spec/integration/assets/fingerprint_spec.rb
hanami-2.0.0.beta1 spec/integration/assets/fingerprint_spec.rb