Sha256: fff49c596d3b9dc768a70e48345150c897af62cf0afe1b9c70d5f3bc85e8ad89

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

# frozen_string_literal: true

RSpec.describe "hanami routes", type: :integration do
  it "prints app routes" do
    with_project do
      generate "app admin"

      write "lib/ping.rb", <<~EOF
        class Ping
          def call(env)
            [200, {}, ["PONG"]]
          end
        end
      EOF

      unshift "config/environment.rb", "require_relative '../lib/ping'"
      replace "config/environment.rb", "Hanami.configure do", "Hanami.configure do\nmount Ping, at: '/ping'"

      generate "action web home#index --url=/"
      generate "action web books#create --url=/books --method=POST"

      generate "action admin home#index --url=/"

      hanami "routes"

      expect(out).to eq "Name Method     Path                           Action                        \n\n                                /ping                          Ping                          \n\n                Name Method     Path                           Action                        \n\n                     GET, HEAD  /admin                         Admin::Controllers::Home::Index\n\n                Name Method     Path                           Action                        \n\n                     GET, HEAD  /                              Web::Controllers::Home::Index \n                     POST       /books                         Web::Controllers::Books::Create"
    end
  end

  it "prints help message" do
    with_project do
      output = <<~OUT
Command:
  hanami routes

Usage:
  hanami routes

Description:
  Prints routes

Options:
  --help, -h                        # Print this help
OUT

      run_cmd 'hanami routes --help', output
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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