Sha256: b591d7e201c0e4119a5beb2e2bc0a83ed2675aecaf9a23332b6534674e82296d

Contents?: true

Size: 616 Bytes

Versions: 5

Compression:

Stored size: 616 Bytes

Contents

require 'spec_helper'

describe Clamp::Command do

  include OutputCapture

  describe "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"])
      stdout.should == "size = 42\n"
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
clamp-0.6.3 spec/clamp/option_module_spec.rb
clamp-0.6.2 spec/clamp/option_module_spec.rb
clamp-0.6.1 spec/clamp/option_module_spec.rb
clamp-0.6.0 spec/clamp/option_module_spec.rb
clamp-0.5.1 spec/clamp/option_module_spec.rb