Sha256: 52985fbff234dbf1ff2a47f9312781c1b5f9be384233fddc4de0e72175efcb39

Contents?: true

Size: 1.02 KB

Versions: 7

Compression:

Stored size: 1.02 KB

Contents

require "hanami"

RSpec.describe "App view / Context / Request", :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(request: request)
  }

  let(:request) { double(:request) }

  describe "#request" do
    it "is the provided request" do
      expect(context.request).to be request
    end
  end

  describe "#sesion" do
    let(:session) { double(:session) }

    before do
      allow(request).to receive(:session) { session }
    end

    it "is the request's session" do
      expect(context.session).to be session
    end
  end

  describe "#flash" do
    let(:flash) { double(:flash) }

    before do
      allow(request).to receive(:flash) { flash }
    end

    it "is the request's flash" do
      expect(context.flash).to be flash
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hanami-2.1.0 spec/integration/view/context/request_spec.rb
hanami-2.1.0.rc3 spec/integration/view/context/request_spec.rb
hanami-2.1.0.rc2 spec/integration/view/context/request_spec.rb
hanami-2.1.0.rc1 spec/integration/view/context/request_spec.rb
hanami-2.1.0.beta2.1 spec/integration/view/context/request_spec.rb
hanami-2.1.0.beta2 spec/integration/view/context/request_spec.rb
hanami-2.1.0.beta1 spec/integration/view/context/request_spec.rb