Fix failing spec
This commit is contained in:
parent
259a220c85
commit
e6a48b8d00
|
@ -15,7 +15,7 @@ class SingleCommandController < AbstractController
|
|||
|
||||
def call
|
||||
@cmd = (message.payload || {})
|
||||
key = cmd.fetch("command", {})["action"].to_s.downcase
|
||||
key = @cmd["action"].to_s.gsub("_", " ").downcase
|
||||
action = AVAILABLE_ACTIONS.fetch(key, :unknown).to_sym
|
||||
send(action)
|
||||
reply 'single_command', confirmation: true, command: cmd
|
||||
|
|
|
@ -24,13 +24,13 @@ describe SingleCommandController do
|
|||
end
|
||||
|
||||
it 'handles parameterless commands' do
|
||||
commands = {"home x" => :home_x,
|
||||
"home y" => :home_y,
|
||||
"home z" => :home_z,
|
||||
"home all" => :home_all,
|
||||
"emergency stop" => :emergency_stop }
|
||||
commands = { "home x" => :home_x,
|
||||
"home y" => :home_y,
|
||||
"home z" => :home_z,
|
||||
"home all" => :home_all,
|
||||
"emergency stop" => :emergency_stop }
|
||||
commands.each do |key, val|
|
||||
message.payload = {"command" => key}
|
||||
message.payload = {"action" => key}
|
||||
controller.call
|
||||
expect(bot.commands.last).to eq(val => [])
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue