Skip to content

Commit

Permalink
Merge pull request #26 from simplybusiness/case-insensitive-command
Browse files Browse the repository at this point in the history
Make command case insensitive
  • Loading branch information
Punit Jain authored Apr 26, 2021
2 parents 03315aa + 082284b commit 806551b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Command

def initialize(config)
@config = config
comment = config.payload['comment']['body'].strip
comment = config.payload['comment']['body'].strip.downcase
error_msg = "Comment must be start with #{COMMAND_PREFIX}"
raise ArgumentError, error_msg unless comment.start_with?(COMMAND_PREFIX)

Expand Down
12 changes: 12 additions & 0 deletions spec/lib/command_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@
expect(action).to receive(:bump_version).with('minor')
Command.new(config).call
end

context 'when comment starts with /Dobby' do
let(:body) { '/Dobby version patch' }

it 'bumps the version' do
action = double
allow(Action).to receive(:new).and_return(action)

expect(action).to receive(:bump_version).with('patch')
Command.new(config).call
end
end
end

context 'for invalid command' do
Expand Down

0 comments on commit 806551b

Please sign in to comment.