spec/unit/hanami/configuration/views_spec.rb in hanami-2.0.0.beta2 vs spec/unit/hanami/configuration/views_spec.rb in hanami-2.0.0.beta3
- old
+ new
@@ -8,11 +8,11 @@
let(:configuration) { described_class.new(app_name: app_name, env: :development) }
let(:app_name) { "MyApp::app" }
subject(:views) { configuration.views }
- context "Hanami::View available" do
+ context "hanami-view is bundled" do
it "exposes Hanami::Views's app configuration" do
is_expected.to be_an_instance_of(Hanami::Configuration::Views)
is_expected.to respond_to(:finalize!)
is_expected.to respond_to(:layouts_dir)
@@ -88,24 +88,13 @@
expect { views.paths = [] }.to raise_error(Dry::Configurable::FrozenConfig)
end
end
end
- context "Hanami::View not available" do
+ context "hanami-view is not bundled" do
before do
- load_error = LoadError.new.tap do |error|
- error.instance_variable_set :@path, "hanami/view"
- end
-
- allow_any_instance_of(described_class)
- .to receive(:require)
- .with(anything)
- .and_call_original
-
- allow_any_instance_of(described_class)
- .to receive(:require)
- .with("hanami/view")
- .and_raise load_error
+ allow(Hanami).to receive(:bundled?).and_call_original
+ expect(Hanami).to receive(:bundled?).with("hanami-view").and_return(false)
end
it "does not expose any settings" do
is_expected.not_to be_an_instance_of(Hanami::Configuration::Views)
is_expected.not_to respond_to(:layouts_dir)