Sha256: df462a852ebe3bea1b860b6ebc2698ed3b73c4a1a3f53d90329fad3546fbb44b

Contents?: true

Size: 1.01 KB

Versions: 13

Compression:

Stored size: 1.01 KB

Contents

require "hanami"

RSpec.describe "App view / Context / Inflector", :app_integration do
  before do
    module TestApp
      class App < Hanami::App
      end
    end

    Hanami.prepare

    module TestApp
      module Views
        class Context < Hanami::View::Context
        end
      end
    end
  end

  let(:context_class) { TestApp::Views::Context }
  subject(:context) { context_class.new }

  describe "#inflector" do
    it "is the app inflector by default" do
      expect(context.inflector).to be TestApp::App.inflector
    end

    context "injected inflector" do
      subject(:context) {
        context_class.new(inflector: inflector)
      }

      let(:inflector) { double(:inflector) }

      it "is the injected inflector" do
        expect(context.inflector).to be inflector
      end

      context "rebuilt context" do
        subject(:new_context) { context.with }

        it "retains the injected inflector" do
          expect(new_context.inflector).to be inflector
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hanami-2.1.0.beta2.1 spec/integration/view/context/inflector_spec.rb
hanami-2.1.0.beta2 spec/integration/view/context/inflector_spec.rb
hanami-2.1.0.beta1 spec/integration/view/context/inflector_spec.rb
hanami-2.0.3 spec/integration/view/context/inflector_spec.rb
hanami-2.0.2 spec/integration/view/context/inflector_spec.rb
hanami-2.0.1 spec/integration/view/context/inflector_spec.rb
hanami-2.0.0 spec/integration/view/context/inflector_spec.rb
hanami-2.0.0.rc1 spec/integration/view/context/inflector_spec.rb
hanami-2.0.0.beta4 spec/integration/view/context/inflector_spec.rb
hanami-2.0.0.beta3 spec/integration/view/context/inflector_spec.rb
hanami-2.0.0.beta2 spec/new_integration/view/context/inflector_spec.rb
hanami-2.0.0.beta1.1 spec/new_integration/view/context/inflector_spec.rb
hanami-2.0.0.beta1 spec/new_integration/view/context/inflector_spec.rb