Sha256: 9d95cee19997c51eaf1cb77a08e8041b41538c542928d3d472fa323318dfc985

Contents?: true

Size: 794 Bytes

Versions: 5

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

require "hanami"

RSpec.describe "App view / Config / Template", :app_integration do
  before do
    module TestApp
      class App < Hanami::App
        config.root = "/test_app"
      end
    end

    Hanami.app.instance_eval(&app_hook) if respond_to?(:app_hook)
    Hanami.app.register_slice :main
    Hanami.app.prepare

    module TestApp
      class View < Hanami::View
      end
    end

    module TestApp
      module Views
        module Article
          class Index < TestApp::View
          end
        end
      end
    end
  end

  subject(:template) { view_class.config.template }
  let(:view_class) { TestApp::Views::Article::Index }

  it "configures the template to match the class name" do
    expect(template).to eq "article/index"
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/integration/view/config/template_spec.rb
hanami-2.2.0 spec/integration/view/config/template_spec.rb
hanami-2.2.0.rc1 spec/integration/view/config/template_spec.rb
hanami-2.2.0.beta2 spec/integration/view/config/template_spec.rb
hanami-2.2.0.beta1 spec/integration/view/config/template_spec.rb