Sha256: f65b2f06362f0c897808c6d8484eb1229ad2e569d8834b2ae743d9cc8bce086a

Contents?: true

Size: 943 Bytes

Versions: 1

Compression:

Stored size: 943 Bytes

Contents

require 'spec_helper'

describe Scripted::Running::SelectCommands do

  let(:command1) { mock }
  let(:command2) { mock }
  let(:group1) { mock :commands => [command1] }
  let(:group2) { mock :commands => [command2] }

  let(:logger) { mock(:logger).as_null_object }

  it "selects the groups you named" do
    groups = { :one => group1, :two => group2 }
    configuration = mock :groups => groups
    select_commands = Scripted::Running::SelectCommands.new(configuration, logger)
    commands = select_commands.commands([:one]) 
    expect(commands.map(&:command)).to eq [command1]
  end

  it "selects the default group when you don't give any names" do
    groups = { :one => group1, :default => group2 }
    configuration = mock :groups => groups
    select_commands = Scripted::Running::SelectCommands.new(configuration, logger)
    commands = select_commands.commands([]) 
    expect(commands.map(&:command)).to eq [command2]
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
scripted-0.0.1 spec/scripted/running/select_commands_spec.rb