Sha256: ca807910e9d6cc0ceaeb33b1102fe3fcbda4a6f59664b3eb593e1d20aa933f13

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

require File.join(File.dirname(__FILE__), '../spec_helper')
require 'git_shizzle'

describe 'Command DSL' do

  context 'when reading commands' do
    it 'should not accept commands without a definition' do
      commands = GitShizzle::Dsl::CommandCollection.new
      command_spec = <<-EOF
command :foo
      EOF

      expect { commands.load command_spec }.to raise_error(GitShizzle::Dsl::CommandDefinitionError, "Command 'foo': #command requires a block.")
    end
  end

  it 'should not accept duplicate identifiers' do
    commands = GitShizzle::Dsl::CommandCollection.new
    command_spec = <<-EOF
command :foo do end
command :foo do end
    EOF

    expect { commands.load command_spec }.to raise_error(GitShizzle::Dsl::DuplicateCommandDefinitionError, "The 'foo' command was specified twice.")
  end

  it 'should not accept empty filters' do
    commands = GitShizzle::Dsl::CommandCollection.new
    command_spec = <<-EOF
command :foo do
  applies_to
end
    EOF

    expect { commands.load command_spec }.to raise_error(GitShizzle::Dsl::CommandDefinitionError, "Command 'foo': #applies_to requires a block.")
  end

  it 'should not accept empty actions' do
    commands = GitShizzle::Dsl::CommandCollection.new
    command_spec = <<-EOF
command :foo do
  action
end
    EOF

    expect { commands.load command_spec }.to raise_error(GitShizzle::Dsl::CommandDefinitionError, "Command 'foo': #action requires a block.")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_shizzle-0.2.6 spec/git-shizzle/dsl_spec.rb