Sha256: 145419195fed7386923159ee5383892c928ea2457ca6e58f099cb083008418d2
Contents?: true
Size: 1.36 KB
Versions: 3
Compression:
Stored size: 1.36 KB
Contents
require "spec_helper" RSpec.describe <%= configuration.project_class %>::CLI::Shell do using Refinements::Pathnames subject(:shell) { described_class.new actions: described_class::ACTIONS.merge(config:) } include_context "with temporary directory" let(:config) { instance_spy <%= configuration.project_class %>::CLI::Actions::Config } describe "#call" do it "edits configuration" do shell.call %w[--config edit] expect(config).to have_received(:call).with(:edit) end it "views configuration" do shell.call %w[--config view] expect(config).to have_received(:call).with(:view) end it "prints version" do expectation = proc { shell.call %w[--version] } expect(&expectation).to output(/<%= configuration.project_label %>\s\d+\.\d+\.\d+/).to_stdout end it "prints help (usage)" do expectation = proc { shell.call %w[--help] } expect(&expectation).to output(/<%= configuration.project_label %>.+USAGE.+/m).to_stdout end it "prints usage when no options are given" do expectation = proc { shell.call } expect(&expectation).to output(/<%= configuration.project_label %>.+USAGE.+/m).to_stdout end it "prints error with invalid option" do expectation = proc { shell.call %w[--bogus] } expect(&expectation).to output(/invalid option.+bogus/).to_stdout end end end
Version data entries
3 entries across 3 versions & 1 rubygems