Sha256: 30e6db54aa7c2ffe80df3154e09c9b235bdb33eebb1b26f653ece53ea17dc5a8
Contents?: true
Size: 1.42 KB
Versions: 11
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require "hanami" RSpec.describe "App view / Context / Assets", :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 "#assets" do context "without assets provider" do it "raises error" do expect { context.assets } .to raise_error(Hanami::ComponentLoadError, /hanami-assets/) end end context "with assets provider" do before do Hanami.app.register_provider(:assets) do start do register "assets", Object.new end end end it "is the app assets by default" do expect(context.assets).to be TestApp::App[:assets] end context "injected assets" do subject(:context) { context_class.new(assets: assets) } let(:assets) { double(:assets) } it "is the injected assets" do expect(context.assets).to be assets end context "rebuilt context" do subject(:new_context) { context.with } it "retains the injected assets" do expect(new_context.assets).to be assets end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems