Sha256: bd6da464a86eb1563e989574833c587bb3f6e90a3a46888e49f6a634cbea41ba

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'
require 'simple_commander/configure'

describe SimpleCommander do
  describe '.configure' do
    it 'calls the given block' do
      expect { SimpleCommander.configure { throw :block_called } }.to throw_symbol(:block_called)
    end

    describe 'called block' do
      before(:each) do
        allow(SimpleCommander::Runner.instance).to receive(:run!)
      end

      it 'provides Commander configuration methods' do
        SimpleCommander.configure do
          program :name, 'test'
        end

        expect(SimpleCommander::Runner.instance.program(:name)).to eq('test')
      end

      it 'passes all arguments to the block' do
        SimpleCommander.configure('foo') do |first_arg|
          program :name, first_arg
        end

        expect(SimpleCommander::Runner.instance.program(:name)).to eq('foo')
      end
    end

    it 'calls Runner#run! after calling the configuration block' do
      expect(SimpleCommander::Runner.instance).to receive(:run!)
      SimpleCommander.configure {}
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
simple_commander-0.6.1 spec/configure_spec.rb
simple_commander-0.6.0 spec/configure_spec.rb
simple_commander-0.5.1 spec/configure_spec.rb
simple_commander-0.5.0 spec/configure_spec.rb
simple_commander-0.4.0 spec/configure_spec.rb
simple_commander-0.3.1 spec/configure_spec.rb
simple_commander-0.3.0 spec/configure_spec.rb
simple_commander-0.1.0 spec/configure_spec.rb