Sha256: e2b93bde56c0aea702129493c2baf2854dc8d260d30e34f4e97de52f85baab0a

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "Project initializers", type: :integration do
  it "mounts Rack middleware" do
    with_project("project_initializers", gems: ["i18n"]) do
      write "config/locales/en.yml", <<~EOF
        en:
          greeting: "Welcome stranger"
      EOF

      write "config/initializers/i18n.rb", <<~EOF
        require 'i18n'
        I18n.load_path = Dir['config/locales/*.yml']
        I18n.backend.load_translations
      EOF

      generate "action web home#index --url=/"
      rewrite "apps/web/views/home/index.rb", <<~EOF
        module Web::Views::Home
          class Index
            include Web::View

            def greeting
              I18n.t(:greeting)
            end
          end
        end
      EOF

      rewrite "apps/web/templates/home/index.html.erb", <<~EOF
        <h1><%= greeting%></h1>
      EOF
      server do
        get "/"

        expect(last_response.body).to include("Welcome stranger")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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