Skip to content

Commit

Permalink
Add a test for string interpolations in attachments & with quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
idrisskettereruserlane committed Nov 22, 2019
1 parent 389ac82 commit 77131a1
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions spec/outputs/slack_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,35 @@ def test_one_event(event, expected_json, expected_url = "http://requestb.in/r9lk
test_one_event(event, expected_json)
end
end

context "when attachements contain interpolations" do
let(:data) { {
"message" => "This message should show in slack",
"x" => "3",
"image" => "http://example.com/image.png",
"textquot" => "Text with \"quotation marks\"",
} }

let(:config) { {
"url" => "http://requestb.in/r9lkbzr9",
"attachments" => [
{"image_url" => "%{message}",
"textquot" => "%{textquot}"
}
]
} }

it "uses and formats all provided values" do
expected_json = {
:text => "This message should show in slack 3",
:attachments => [{
:image_url => "http://example.com/image.png",
:textquot => "Text with \"quotation marks\""
}]
}
test_one_event(event, expected_json)
end
end
end

describe "interpolation in url field" do
Expand Down

0 comments on commit 77131a1

Please sign in to comment.