File: fix-tests-support-rspec3

package info (click to toggle)
ruby-hipchat 1.5.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, stretch
  • size: 296 kB
  • ctags: 110
  • sloc: ruby: 1,574; makefile: 5
file content (97 lines) | stat: -rw-r--r-- 3,228 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
Description: Make tests support RSpec 3
 Tests contained deprecated methods. Made them support new RSpec3 syntax.
Author: Balasankar C <balasankarc@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'