Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/chatops/controller/test_case_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def extract_named_params(command_string)
arg = command_string[last_index..-1]
matches = arg.match(/ --(\S+)(.*)/)
params[matches[1]] = matches[2].strip
params[matches[1]] = "true" unless params[matches[1]].present?
command_string = command_string.slice(0, last_index)
end

Expand Down
7 changes: 7 additions & 0 deletions spec/lib/chatops/controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ def ensure_app_given
expect(chatop_response).to eq "You can deploy foobar just fine."
end

it "works with boolean arguments" do
chat "where can i deploy foobar --this-is-sparta", "bhuga"
expect(request.params["action"]).to eq "wcid"
expect(request.params["user"]).to eq "bhuga"
expect(request.params["params"]["this-is-sparta"]).to eq "true"
end

it "anchors regexes" do
expect {
chat "too bad that this message doesn't start with where can i deploy foobar", "bhuga"
Expand Down