[DRE-commits] [ruby-flowdock] 02/04: fix tests

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Fri Sep 22 08:16:19 UTC 2017


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository ruby-flowdock.

commit 49997feda7c7a8b9843f0a62a620df79f9e849c9
Author: Pirate Praveen <praveen at debian.org>
Date:   Fri Sep 22 13:21:51 2017 +0530

    fix tests
---
 debian/patches/port-to-webmock3.patch | 99 +++++++++++++++++++++++++++++++++++
 debian/patches/series                 |  1 +
 2 files changed, 100 insertions(+)

diff --git a/debian/patches/port-to-webmock3.patch b/debian/patches/port-to-webmock3.patch
new file mode 100644
index 0000000..95a811a
--- /dev/null
+++ b/debian/patches/port-to-webmock3.patch
@@ -0,0 +1,99 @@
+From 8275d2ed77dd491b922197f6b11766019b1bbc7b Mon Sep 17 00:00:00 2001
+From: kp <kpisgod at gmail.com>
+Date: Fri, 22 Sep 2017 09:08:59 +0530
+Subject: [PATCH] fix spec for webmock 3.0
+
+---
+ spec/flowdock_spec.rb | 16 ++++++++--------
+ spec/spec_helper.rb   |  2 +-
+ 2 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/spec/flowdock_spec.rb b/spec/flowdock_spec.rb
+index 9a8d63b..5b442cf 100644
+--- a/spec/flowdock_spec.rb
++++ b/spec/flowdock_spec.rb
+@@ -416,7 +416,7 @@ def join_tokens(tokens)
+ 
+       it 'posts to /messages' do
+         expect {
+-          stub_request(:post, "https://#{token}:@api.flowdock.com/v1/messages").
++          stub_request(:post, "https://api.flowdock.com/v1/messages").
+             with(:body => MultiJson.dump(flow: flow, content: "foobar", tags: [], event: "message"), :headers => {"Accept" => "application/json", "Content-Type" => "application/json"}).
+             to_return(:status => 201, :body => '{"id":123}', :headers => {"Content-Type" => "application/json"})
+           res = client.chat_message(flow: flow, content: 'foobar')
+@@ -425,7 +425,7 @@ def join_tokens(tokens)
+       end
+       it 'posts to /comments' do
+         expect {
+-          stub_request(:post, "https://#{token}:@api.flowdock.com/v1/comments").
++          stub_request(:post, "https://api.flowdock.com/v1/comments").
+             with(:body => MultiJson.dump(flow: flow, content: "foobar", message: 12345, tags: [], event: "comment"), :headers => {"Accept" => "application/json", "Content-Type" => "application/json"}).
+             to_return(:status => 201, :body => '{"id":1234}', :headers => {"Content-Type" => "application/json"})
+           res = client.chat_message(flow: flow, content: 'foobar', message: 12345)
+@@ -434,7 +434,7 @@ def join_tokens(tokens)
+       end
+       it 'posts to /private/:user_id/messages' do
+         expect {
+-          stub_request(:post, "https://#{token}:@api.flowdock.com/v1/private/12345/messages").
++          stub_request(:post, "https://api.flowdock.com/v1/private/12345/messages").
+             with(:body => MultiJson.dump(content: "foobar", event: "message"), :headers => {"Accept" => "application/json", "Content-Type" => "application/json"}).
+             to_return(:status => 201, :body => '{"id":1234}', :headers => {"Content-Type" => "application/json"})
+           res = client.private_message(user_id: "12345", content: 'foobar')
+@@ -454,7 +454,7 @@ def join_tokens(tokens)
+       end
+       it 'handles error responses' do
+         expect {
+-          stub_request(:post, "https://#{token}:@api.flowdock.com/v1/messages").
++          stub_request(:post, "https://api.flowdock.com/v1/messages").
+             to_return(:body => '{"message":"Validation error","errors":{"content":["can\'t be blank"],"external_user_name":["should not contain whitespace"]}}',
+                       :status => 400)
+           client.chat_message(flow: flow, content: 'foobar')
+@@ -464,7 +464,7 @@ def join_tokens(tokens)
+ 
+     describe 'GET' do
+       it 'does abstract get with params' do
+-        stub_request(:get, "https://#{token}:@api.flowdock.com/v1/some_path?sort_by=date").
++        stub_request(:get, "https://api.flowdock.com/v1/some_path?sort_by=date").
+           with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
+           to_return(:status => 200, :body => '{"id": 123}', :headers => {"Content-Type" => "application/json"})
+         expect(client.get('/some_path', {sort_by: 'date'})).to eq({"id" => 123})
+@@ -473,7 +473,7 @@ def join_tokens(tokens)
+ 
+     describe 'POST' do
+       it 'does abstract post with body' do
+-        stub_request(:post, "https://#{token}:@api.flowdock.com/v1/other_path").
++        stub_request(:post, "https://api.flowdock.com/v1/other_path").
+           with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}, :body => MultiJson.dump(name: 'foobar')).
+           to_return(:status => 200, :body => '{"id": 123,"name": "foobar"}', :headers => {"Content-Type" => "application/json"})
+         expect(client.post('other_path', {name: 'foobar'})).to eq({"id" => 123, "name" => "foobar"})
+@@ -483,7 +483,7 @@ def join_tokens(tokens)
+ 
+     describe 'PUT' do
+       it 'does abstract put with body' do
+-        stub_request(:put, "https://#{token}:@api.flowdock.com/v1/other_path").
++        stub_request(:put, "https://api.flowdock.com/v1/other_path").
+           with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}, :body => MultiJson.dump(name: 'foobar')).
+           to_return(:status => 200, :body => '{"id": 123,"name": "foobar"}', :headers => {"Content-Type" => "application/json"})
+         expect(client.put('other_path', {name: 'foobar'})).to eq({"id" => 123, "name" => "foobar"})
+@@ -492,7 +492,7 @@ def join_tokens(tokens)
+ 
+     describe 'DELETE' do
+       it 'does abstract delete with params' do
+-        stub_request(:delete, "https://#{token}:@api.flowdock.com/v1/some_path").
++        stub_request(:delete, "https://api.flowdock.com/v1/some_path").
+           with(:headers => {'Accept'=>'application/json', 'Content-Type'=>'application/json'}).
+           to_return(:status => 200, :body => '', :headers => {"Content-Type" => "application/json"})
+         expect(client.delete('/some_path')).to eq({})
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+index 58e7964..3daa86e 100644
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -2,7 +2,7 @@
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
+ require 'rspec'
+ require 'webmock/rspec'
+-
++require 'securerandom'
+ require 'flowdock'
+ 
+ # Requires supporting files with custom matchers and macros, etc,
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..f3f87b2
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+port-to-webmock3.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-flowdock.git



More information about the Pkg-ruby-extras-commits mailing list