Sha256: 50f93eff299c118f7068df001249693f82f2434da52e584e84522a93dba43034

Contents?: true

Size: 1.13 KB

Versions: 17

Compression:

Stored size: 1.13 KB

Contents

# frozen_string_literal: true

require "stringio"

RSpec.describe "App routes helper", :app_integration do
  specify "Routing to actions based on their container identifiers" do
    with_tmp_directory(Dir.mktmpdir) do
      write "config/app.rb", <<~RUBY
        require "hanami"

        module TestApp
          class App < Hanami::App
            config.logger.stream = StringIO.new
          end
        end
      RUBY

      write "config/routes.rb", <<~RUBY
        module TestApp
          class Routes < Hanami::Routes
            root to: "home.index"
          end
        end
      RUBY

      write "app/actions/home/index.rb", <<~RUBY
        require "hanami/action"

        module TestApp
          module Actions
            module Home
              class Index < Hanami::Action
                def handle(*, res)
                  res.body = "Hello world"
                end
              end
            end
          end
        end
      RUBY

      require "hanami/prepare"

      expect(TestApp::App["routes"].path(:root)).to eq "/"
      expect(TestApp::App["routes"].url(:root).to_s).to match /http:\/\/.*\//
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.2.0 spec/integration/container/application_routes_helper_spec.rb
hanami-2.2.0.rc1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.2.0.beta2 spec/integration/container/application_routes_helper_spec.rb
hanami-2.2.0.beta1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.rc3 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.rc2 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.rc1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.beta2.1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.beta2 spec/integration/container/application_routes_helper_spec.rb
hanami-2.1.0.beta1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.0.3 spec/integration/container/application_routes_helper_spec.rb
hanami-2.0.2 spec/integration/container/application_routes_helper_spec.rb
hanami-2.0.1 spec/integration/container/application_routes_helper_spec.rb
hanami-2.0.0 spec/integration/container/application_routes_helper_spec.rb
hanami-2.0.0.rc1 spec/integration/container/application_routes_helper_spec.rb