Sha256: 211ae2bcdb9c71f55ada9dc0424d0cf2c7c4c26369562df9ccc11b7424d5ac0b

Contents?: true

Size: 655 Bytes

Versions: 10

Compression:

Stored size: 655 Bytes

Contents

require 'spec_helper'

describe Clamp::Command do

  include OutputCapture

  describe "with included module" do
    
    before 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 = @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

10 entries across 10 versions & 2 rubygems

Version Path
clamp-0.5.0 spec/clamp/option_module_spec.rb
clamp-0.4.0 spec/clamp/option_module_spec.rb
jls-clamp-0.3.1.2 spec/clamp/option_module_spec.rb
jls-clamp-0.3.1 spec/clamp/option_module_spec.rb
clamp-0.3.1 spec/clamp/option_module_spec.rb
clamp-0.3.0 spec/clamp/option_module_spec.rb
clamp-0.2.3 spec/clamp/option_module_spec.rb
clamp-0.2.2 spec/clamp/option_module_spec.rb
clamp-0.2.1 spec/clamp/option_module_spec.rb
clamp-0.2.0 spec/clamp/option_module_spec.rb