Sha256: 7178ee7f677b4c808de61c4fe9a806cb5ea126bc58b01e850d26c7c395f28a8f

Contents?: true

Size: 1.1 KB

Versions: 10

Compression:

Stored size: 1.1 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,
      response: response,
    )
  }

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

  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(response).to receive(:flash) { flash }
    end

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

Version data entries

10 entries across 10 versions & 1 rubygems

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