Sha256: 2218d1c0cd03cdfca0dd6c71f536991a7b80e49ee9a82e8562a019983626e385

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

require 'git_shizzle'

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

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

  it 'should not accept duplicate identifiers' do
    command_spec = <<-EOF
command :foo do end
command :foo do end
    EOF

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

  it 'should not accept empty filters' do
    command_spec = <<-EOF
command :foo do
  applies_to
end
    EOF

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

  it 'should not accept empty actions' do
    command_spec = <<-EOF
command :foo do
  action
end
    EOF

    expect { subject.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.8 spec/git_shizzle/dsl_spec.rb