Sha256: c63dc1811754b9a944e9f19578b7cbca1bf2641ede32096eab5126622e3cb57f
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
# frozen_string_literal: true require "hanami/config" require "hanami/action" RSpec.describe Hanami::Config, "#actions" do let(:config) { described_class.new(app_name: app_name, env: :development) } let(:app_name) { "MyApp::app" } subject(:actions) { config.actions } context "hanami-controller is bundled" do it "is a full actions config" do is_expected.to be_an_instance_of(Hanami::Config::Actions) is_expected.to respond_to(:default_response_format) is_expected.to respond_to(:default_response_format=) end it "configures base action settings" do expect { actions.default_request_format = :json } .to change { actions.default_request_format } .to :json end it "configures base actions settings using custom methods" do actions.formats = {} expect { actions.format json: "app/json" } .to change { actions.formats } .to("app/json" => :json) end it "can be finalized" do is_expected.to respond_to(:finalize!) end end context "hanami-controller is not bundled" do before do allow(Hanami).to receive(:bundled?).and_call_original expect(Hanami).to receive(:bundled?).with("hanami-controller").and_return(false) end it "does not expose any settings" do is_expected.to be_an_instance_of(Hanami::Config::NullConfig) is_expected.not_to respond_to(:default_response_format) is_expected.not_to respond_to(:default_response_format=) end it "can be finalized" do is_expected.to respond_to(:finalize!) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
hanami-2.0.0.rc1 | spec/unit/hanami/config/actions_spec.rb |