Sha256: d2fa416664cfcba8cd66a0a3ec2eaa6030ad33fd79bc4c1dff779e2b7c175489

Contents?: true

Size: 914 Bytes

Versions: 3

Compression:

Stored size: 914 Bytes

Contents

# frozen_string_literal: true

RSpec.describe "rackup", type: :integration do
  it "serves contents from database" do
    with_project do
      setup_model
      console do |input, _, _|
        input.puts("BookRepository.new.create(title: 'Learn Hanami')")
        input.puts("exit")
      end

      generate "action web books#show --url=/books/:id"
      rewrite  "apps/web/controllers/books/show.rb", <<~EOF
        module Web::Controllers::Books
          class Show
            include Web::Action
            expose :book

            def call(params)
              @book = BookRepository.new.find(params[:id]) or halt(404)
            end
          end
        end
      EOF
      rewrite "apps/web/templates/books/show.html.erb", <<~EOF
        <h1><%= book.title %></h1>
      EOF

      rackup do
        visit "/books/1"
        expect(page).to have_content("Learn Hanami")
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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