Skip to content

Commit

Permalink
WIP: first set of end-to-end specs to test 1.x combat w/ 2.x changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenosloan committed Feb 2, 2016
1 parent 6e6a4df commit 417a66d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions spec/end_to_end_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'spec_helper'

RSpec.describe Slack::Notifier do

before :each do
@http_client = double("Slack::Notifier::DefaultHTTPClient")
end

{
['hello', {}] =>
{ payload: { text:"hello" }.to_json },

['[hello](http://example.com/world)', {}] =>
{ payload: { text: '<http://example.com/world|hello>' }.to_json },

['<a href="http://example.com">example</a>', {}] =>
{ payload: { text: '<http://example.com|example>' }.to_json }

}.each do |args, payload|

it "sends correct payload for #{args}" do
msg, options = *args
msg, options = '', msg if options.nil?

notifier = Slack::Notifier.new 'http://example.com', http_client: @http_client

expect( @http_client ).to receive(:post)
.with( URI.parse('http://example.com'),
payload )

notifier.ping msg, options
end
end


end

0 comments on commit 417a66d

Please sign in to comment.