Sha256: a1a17bdfd0eede082f648ec8bfb4b9691ee1022b7cbc1ac3dfd74105e735d1d5

Contents?: true

Size: 648 Bytes

Versions: 3

Compression:

Stored size: 648 Bytes

Contents

# frozen_string_literal: true

require "spec_helper"

describe Clamp::Command do

  include OutputCapture

  context "with included module" do

    let(:command) do

      shared_options = Module.new do
        extend Clamp::Option::Declaration
        option "--size", "SIZE", default: 4
      end

      command_class = Class.new(Clamp::Command) do

        include shared_options

        def execute
          puts "size = #{size}"
        end

      end

      command_class.new("foo")

    end

    it "accepts options from included module" do
      command.run(["--size", "42"])
      expect(stdout).to eql "size = 42\n"
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clamp-1.3.2 spec/clamp/option_module_spec.rb
clamp-1.3.1 spec/clamp/option_module_spec.rb
clamp-1.3.0 spec/clamp/option_module_spec.rb