[DRE-commits] [ruby-hipchat] 03/04: Make tests run

Balasankar C balasankarc-guest at moszumanska.debian.org
Tue Jul 28 07:46:15 UTC 2015


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

balasankarc-guest pushed a commit to branch master
in repository ruby-hipchat.

commit 8a6b7a70cf2fb5f63d7fb47964d9a4548425dcde
Author: Balasankar C <balasankarc at autistici.org>
Date:   Tue Jul 28 13:13:25 2015 +0530

    Make tests run
---
 debian/patches/fix-tests-support-rspec3 | 97 +++++++++++++++++++++++++++++++++
 debian/patches/series                   |  1 +
 debian/ruby-tests.rake                  |  7 +++
 debian/ruby-tests.rb                    |  2 -
 4 files changed, 105 insertions(+), 2 deletions(-)

diff --git a/debian/patches/fix-tests-support-rspec3 b/debian/patches/fix-tests-support-rspec3
new file mode 100644
index 0000000..9a6bb48
--- /dev/null
+++ b/debian/patches/fix-tests-support-rspec3
@@ -0,0 +1,97 @@
+Description: Make tests support RSpec 3
+ Tests contained deprecated methods. Made them support new RSpec3 syntax.
+Author: Balasankar C <balasankarc at autistici.org>
+Last-Update: 2015-07-23
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/spec/hipchat_api_v2_spec.rb
++++ b/spec/hipchat_api_v2_spec.rb
+@@ -203,7 +203,7 @@
+     it "successfully" do
+       mock_successful_file_send 'Dude', 'Hello world', file
+ 
+-      room.send_file("Dude", "Hello world", file).should be_truthy
++      expect(room.send_file("Dude", "Hello world", file)).to be_truthy
+     end
+ 
+     it "but fails when the room doesn't exist" do
+@@ -211,7 +211,7 @@
+         OpenStruct.new(:code => 404)
+       }
+ 
+-      lambda { room.send_file "", "", file }.should raise_error(HipChat::UnknownRoom)
++      expect { room.send_file "", "", file }.to raise_error(HipChat::UnknownRoom)
+     end
+ 
+     it "but fails when we're not allowed to do so" do
+@@ -219,11 +219,11 @@
+         OpenStruct.new(:code => 401)
+       }
+ 
+-      lambda { room.send_file "", "", file }.should raise_error(HipChat::Unauthorized)
++      expect { room.send_file "", "", file }.to raise_error(HipChat::Unauthorized)
+     end
+ 
+     it "but fails if the username is more than 15 chars" do
+-      lambda { room.send_file "a very long username here", "a message", file }.should raise_error(HipChat::UsernameTooLong)
++      expect { room.send_file "a very long username here", "a message", file }.to raise_error(HipChat::UsernameTooLong)
+     end
+ 
+     it "but fails if we get an unknown response code" do
+@@ -231,8 +231,8 @@
+         OpenStruct.new(:code => 403)
+       }
+ 
+-      lambda { room.send_file "", "", file }.
+-        should raise_error(HipChat::UnknownResponseCode)
++      expect { room.send_file "", "", file }.
++        to raise_error(HipChat::UnknownResponseCode)
+     end
+   end
+ 
+@@ -332,7 +332,7 @@
+ 
+     it 'successfully returns history' do
+       mock_successful_user_history
+-      user.history.should be_truthy
++      expect(user.history).to be_truthy
+     end
+ 
+     it 'has allowed params' do
+@@ -353,7 +353,7 @@
+     it "successfully with a standard file" do
+       mock_successful_user_send_file 'Equal bytes for everyone', file
+ 
+-      user.send_file('Equal bytes for everyone', file).should be_truthy
++      expect(user.send_file('Equal bytes for everyone', file)).to be_truthy
+     end
+ 
+     it "but fails when the user doesn't exist" do
+@@ -361,7 +361,7 @@
+         OpenStruct.new(:code => 404)
+       }
+ 
+-      lambda { user.send_file "", file }.should raise_error(HipChat::UnknownUser)
++      expect { user.send_file "", file }.to raise_error(HipChat::UnknownUser)
+     end
+ 
+     it "but fails when we're not allowed to do so" do
+@@ -369,7 +369,7 @@
+         OpenStruct.new(:code => 401)
+       }
+ 
+-      lambda { user.send_file "", file }.should raise_error(HipChat::Unauthorized)
++      expect { user.send_file "", file }.to raise_error(HipChat::Unauthorized)
+     end
+   end
+ end
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -2,7 +2,6 @@
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
+ require 'hipchat'
+ require 'rspec'
+-require 'rspec/autorun'
+ require 'json'
+ require 'webmock/rspec'
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..01afc86
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-tests-support-rspec3
diff --git a/debian/ruby-tests.rake b/debian/ruby-tests.rake
new file mode 100644
index 0000000..dcc1601
--- /dev/null
+++ b/debian/ruby-tests.rake
@@ -0,0 +1,7 @@
+require 'rspec/core/rake_task'
+
+RSpec::Core::RakeTask.new(:spec) do |spec|
+  spec.pattern = './spec/**/*_spec.rb'
+end
+
+task :default => :spec
diff --git a/debian/ruby-tests.rb b/debian/ruby-tests.rb
deleted file mode 100644
index 44dafad..0000000
--- a/debian/ruby-tests.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# basic testing only, webmock, coveralls missing in the archive
-require 'hipchat'

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



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