Sha256: be77ea539c0751ec27422023e6a89eacb83761d11464eeffa0ccb68bf6817fc9

Contents?: true

Size: 1.29 KB

Versions: 10

Compression:

Stored size: 1.29 KB

Contents

require "spec_helper"

RSpec.describe <%= settings.project_namespaced_class %>::CLI::Shell do
<% if settings.build_refinements %>
  using Refinements::Pathname
  using Refinements::StringIO
<% end %>

  subject(:shell) { described_class.new }

  include_context "with application dependencies"

  before { Sod::Container.stub! logger:, io: }

  after { Sod::Container.restore }

  describe "#call" do
    it "prints configuration usage" do
      shell.call %w[config]
<% if settings.build_refinements %>
      expect(io.reread).to match(/Manage configuration.+/m)
<% else %>
      expect(io.tap(&:rewind).read).to match(/Manage configuration.+/m)
<% end %>
    end

    it "prints version" do
      shell.call %w[--version]
<% if settings.build_refinements %>
      expect(io.reread).to match(/<%= settings.project_label.gsub(" ", "\\s") %>\s\d+\.\d+\.\d+/)
<% else %>
      expect(io.tap(&:rewind).read).to match(/<%= settings.project_label.gsub(" ", "\\s") %>\s\d+\.\d+\.\d+/)
<% end %>
    end

    it "prints help" do
      shell.call %w[--help]
<% if settings.build_refinements %>
      expect(io.reread).to match(/<%= settings.project_label.gsub(" ", "\\s") %>.+USAGE.+/m)
<% else %>
      expect(io.tap(&:rewind).read).to match(/<%= settings.project_label.gsub(" ", "\\s") %>.+USAGE.+/m)
<% end %>
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gemsmith-22.10.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.9.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.8.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.7.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.6.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.5.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.4.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.3.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.2.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb
gemsmith-22.1.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/shell_spec.rb.erb