Sha256: af7f91682c0ab886d2c3b788ec929b44a60cc6d6b89ee85bb4620c007473840b
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true 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 = File.new("/dev/null", "w") end end RUBY write "config/routes.rb", <<~RUBY module TestApp class Routes < Hanami::Routes define do root to: "home.index" end 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
3 entries across 3 versions & 1 rubygems