Sha256: 62e9eb3d48bab2a5732e7ae3368760fe10966b2ef9725f87af9ec4262d4ee8da

Contents?: true

Size: 663 Bytes

Versions: 2

Compression:

Stored size: 663 Bytes

Contents

require "spec_helper"

RSpec.describe <%= configuration.project_namespaced_class %>::CLI::Parser do
  subject(:parser) { described_class.new }

  include_context "with application container"

  describe "#call" do
    it "answers hash with valid option" do
      expect(parser.call(%w[--help])).to have_attributes(action_help: true)
    end

    it "fails with invalid option" do
      expectation = proc { parser.call %w[--bogus] }
      expect(&expectation).to raise_error(OptionParser::InvalidOption, /--bogus/)
    end
  end

  describe "#to_s" do
    it "answers usage" do
      parser.call
      expect(parser.to_s).to match(/.+USAGE.+/m)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gemsmith-17.0.1 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb
gemsmith-17.0.0 lib/gemsmith/templates/%project_name%/spec/lib/%project_path%/cli/parser_spec.rb.erb