Sha256: 6e077c6f238cf563f4ad70479dbd4fa80e126d3dd84d09ab2fe5cfcea65d4d73

Contents?: true

Size: 856 Bytes

Versions: 22

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require 'eac_cli/runner_with/confirmation'

::RSpec.describe ::EacCli::RunnerWith::Confirmation do
  let(:runner) do
    the_module = described_class
    Class.new do
      include the_module

      runner_definition do
        desc 'A stub runner.'
      end

      def run
        if confirm?
          ::Kernel.puts 'Accepted'
        else
          ::Kernel.puts 'Denied'
        end
      end
    end
  end

  let(:instance) { runner.create(argv: runner_argv) }

  context 'without --no option' do
    let(:runner_argv) { %w[--no] }

    it do
      expect { instance.run }.to output("Denied\n").to_stdout_from_any_process
    end
  end

  context 'without --yes option' do
    let(:runner_argv) { %w[--yes] }

    it do
      expect { instance.run }.to output("Accepted\n").to_stdout_from_any_process
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
eac_tools-0.62.1 sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb
eac_tools-0.62.0 sub/eac_cli/spec/lib/eac_cli/runner_with/confirmation_spec.rb