From f9dbbf7d4faf40e8f29e8c3ec64c61dd6915aa20 Mon Sep 17 00:00:00 2001 From: Tim Riley Date: Tue, 12 Nov 2024 22:33:04 -0600 Subject: [PATCH] Stub bundle install in install spec --- spec/unit/hanami/cli/commands/app/install_spec.rb | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/spec/unit/hanami/cli/commands/app/install_spec.rb b/spec/unit/hanami/cli/commands/app/install_spec.rb index fa25d38b..d1ad21e0 100644 --- a/spec/unit/hanami/cli/commands/app/install_spec.rb +++ b/spec/unit/hanami/cli/commands/app/install_spec.rb @@ -1,15 +1,22 @@ # frozen_string_literal: true RSpec.describe Hanami::CLI::Commands::App::Install do - subject { described_class.new(out: stdout) } - let(:stdout) { StringIO.new } + subject { described_class.new(fs: fs, bundler: bundler, out: out) } + + let(:fs) { Hanami::CLI::Files.new(memory: true, out: out) } + let(:bundler) { Hanami::CLI::Bundler.new(fs: fs) } + let(:out) { StringIO.new } describe "#call" do it "installs third-party plugins" do + expect(bundler).to receive(:install!) + .exactly(1).time + .and_return(true) + subject.call - stdout.rewind - expect(stdout.read.chomp).to eq("") + out.rewind + expect(out.read.chomp).to eq("") end end end