Sha256: d21052001d8606fcf07a0d57ecf5455968be0f1dc3c003e6961812f9889523a2

Contents?: true

Size: 880 Bytes

Versions: 18

Compression:

Stored size: 880 Bytes

Contents

# frozen_string_literal: true

require "hanami/config/actions"

RSpec.describe Hanami::Config::Actions, "#cookies" do
  let(:config) { described_class.new }
  subject(:cookies) { config.cookies }

  context "default config" do
    it "is enabled" do
      expect(cookies).to be_enabled
    end

    it "is an empty hash" do
      expect(cookies.to_h).to eq({})
    end
  end

  context "options given" do
    before do
      config.cookies = {max_age: 300}
    end

    it "is enabled" do
      expect(cookies).to be_enabled
    end

    it "returns the given options" do
      expect(cookies.to_h).to eq(max_age: 300)
    end
  end

  context "nil value given" do
    before do
      config.cookies = nil
    end

    it "is not enabled" do
      expect(cookies).not_to be_enabled
    end

    it "returns an empty hash" do
      expect(cookies.to_h).to eq({})
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
hanami-2.2.1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.2.0 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.2.0.rc1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.2.0.beta2 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.2.0.beta1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.rc3 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.rc2 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.rc1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.beta2.1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.beta2 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.1.0.beta1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.3 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.2 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.0 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.0.rc1 spec/unit/hanami/config/actions/cookies_spec.rb
hanami-2.0.0.beta4 spec/unit/hanami/config/actions/cookies_spec.rb