Sha256: 17ccd17da29b521c59caa0c3f828bd7d2131761331b22cbbe1917262a7d7075f

Contents?: true

Size: 923 Bytes

Versions: 9

Compression:

Stored size: 923 Bytes

Contents

# frozen_string_literal: true

require "hanami"
require "hanami/settings"

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

      class Settings < Hanami::Settings
      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 "#settings" do
    it "is the app settings by default" do
      expect(context.settings).to be TestApp::App["settings"]
    end

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

      let(:settings) { double(:settings) }

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/integration/view/context/settings_spec.rb
hanami-2.2.0 spec/integration/view/context/settings_spec.rb
hanami-2.2.0.rc1 spec/integration/view/context/settings_spec.rb
hanami-2.2.0.beta2 spec/integration/view/context/settings_spec.rb
hanami-2.2.0.beta1 spec/integration/view/context/settings_spec.rb
hanami-2.1.0 spec/integration/view/context/settings_spec.rb
hanami-2.1.0.rc3 spec/integration/view/context/settings_spec.rb
hanami-2.1.0.rc2 spec/integration/view/context/settings_spec.rb
hanami-2.1.0.rc1 spec/integration/view/context/settings_spec.rb