diff --git a/spec/outputs/slack_spec.rb b/spec/outputs/slack_spec.rb index fe1cbad..a3970fd 100644 --- a/spec/outputs/slack_spec.rb +++ b/spec/outputs/slack_spec.rb @@ -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" => "%{image}", + "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