tinder 1.9.4 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 62bf52725d491eb5a5025b497cb61f083265e7a9
4
- data.tar.gz: 19303985a7d40659e5ffd0122c0d71acbb7f1122
3
+ metadata.gz: 50c72ad3e132534c8ea6bd580bdf08f8ae887de9
4
+ data.tar.gz: 44a5904f7f5e3a7b4c696252001bbfe3a496049d
5
5
  SHA512:
6
- metadata.gz: c12b3b0ca6fc98885bb9711b1d18b9af65d0a7a9e30cac8747b6fea1229153d206cfc3d96789fcd7c7b3135e4945eea32fdb768d9d4f269d2c23cd04ba0865da
7
- data.tar.gz: 3149d2d8a6ece3607e0d5a369281ad8ad5424040a038a68bf5f6e2b87d838cc452629a73d51d6db5872a247d714012b71bfbd20bb9756d6b2e2e2bfa6484e598
6
+ metadata.gz: 6ef6c40d79948f38dc1c631fa0473530501c228a86266891595ae81cb70d58f95f2c2899bff1d27ad6f3f96901d65530b2138d6c5a9b7d9c2cb2e501d545a19f
7
+ data.tar.gz: defdff16dd87556202c1494c4613fac0357b369b5a51de573fd4d638c96791c464ee9b2d69a2f62249580fb5bcf5daf11a0fb3ea1b58e664166281e62ddec507
data/.rspec CHANGED
@@ -1,3 +1,2 @@
1
1
  --color
2
- --format=nested
3
2
  --backtrace
@@ -1,13 +1,10 @@
1
1
  language: ruby
2
2
  rvm:
3
- - rbx-2.1
3
+ - rbx-2
4
4
  - jruby-19mode
5
- - jruby-18mode
6
- - 1.8.7
7
- - 1.9.2
8
5
  - 1.9.3
9
6
  - 2.0.0
10
- - 2.1.0
7
+ - 2.1
11
8
  only:
12
9
  - master
13
10
  notifications:
@@ -1,3 +1,7 @@
1
+ 1.10.0 - 2014-08-06
2
+ * Update Faraday dependency
3
+ * Loosen mime-type dependency
4
+
1
5
  1.9.4 - 2014-02-24
2
6
  * Fix typos in MIT licence
3
7
  * Add Campfire#presence to get a list of rooms in which you are present
@@ -1,5 +1,10 @@
1
1
  # Tinder - get the Campfire started
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/tinder.png)](http://badge.fury.io/rb/tinder)
4
+ [![Build Status](https://travis-ci.org/collectiveidea/tinder.png?branch=master)](https://travis-ci.org/collectiveidea/tinder)
5
+ [![Code Climate](https://codeclimate.com/github/collectiveidea/tinder.png)](https://codeclimate.com/github/collectiveidea/tinder)
6
+ [![Dependency Status](https://gemnasium.com/collectiveidea/tinder.png)](https://gemnasium.com/collectiveidea/tinder)
7
+
3
8
  Tinder is a library for interfacing with Campfire, the chat application from 37Signals, allowing you to programmatically manage and speak/listen in chat rooms. As of December 2009, thanks to initial work from Joshua Peek at 37signals, it now makes use of the official Campfire API (described at: http://developer.37signals.com/campfire/).
4
9
 
5
10
  ## Usage
@@ -24,22 +29,19 @@ See the RDoc for more details.
24
29
 
25
30
  gem install tinder
26
31
 
27
- ## Continuous Integration
28
-
29
- [![Build Status](https://secure.travis-ci.org/collectiveidea/tinder.png)](http://travis-ci.org/collectiveidea/tinder) [![Dependency Status](https://gemnasium.com/collectiveidea/tinder.png)](https://gemnasium.com/collectiveidea/tinder)
30
-
31
- ## How to contribute
32
+ ## Contributions
32
33
 
33
- If you find what looks like a bug:
34
+ Tinder is open source and contributions from the community are encouraged! No contribution is too small. Please consider:
34
35
 
35
- 1. Check the GitHub issue tracker to see if anyone else has had the same issue.
36
- http://github.com/collectiveidea/tinder/issues/
37
- 2. If you don't see anything, create an issue with information on how to reproduce it.
36
+ * adding an awesome feature
37
+ * fixing a terrible bug
38
+ * updating documentation
39
+ * fixing a not-so-bad bug
40
+ * fixing typos
38
41
 
39
- If you want to contribute an enhancement or a fix:
42
+ For the best chance of having your changes merged, please:
40
43
 
41
- 1. Fork the project on github.
42
- http://github.com/collectiveidea/tinder
43
- 2. Make your changes with tests.
44
- 3. Commit the changes without making changes to the Rakefile, VERSION, or any other files that aren't related to your enhancement or fix
45
- 4. Send a pull request.
44
+ 1. Ask us! We'd love to hear what you're up to.
45
+ 2. Fork the project.
46
+ 3. Commit your changes and tests (if applicable (they're applicable)).
47
+ 4. Submit a pull request with a thorough explanation and at least one animated GIF.
@@ -1,11 +1,16 @@
1
1
  # encoding: UTF-8
2
2
  require 'faraday'
3
+ require 'faraday/request/multipart'
3
4
  require 'faraday/response/raise_on_authentication_failure'
4
5
  require 'faraday/response/remove_whitespace'
5
6
  require 'faraday_middleware'
6
7
  require 'json'
7
8
  require 'uri'
8
9
 
10
+ class Faraday::RequestOptions
11
+ attr_accessor :preserve_raw
12
+ end
13
+
9
14
  module Tinder
10
15
  class Connection
11
16
  HOST = 'campfirenow.com'
@@ -204,13 +204,18 @@ module Tinder
204
204
  @stream = nil
205
205
  end
206
206
 
207
- # Get the transcript for the given date (returns an array of messages parsed
208
- # via #parse_message, see #parse_message for format of returned message)
207
+ # Get the transcript for the given date (Returns a hash in the same format as #listen)
208
+ #
209
+ # room.transcript(Time.now)
210
+ # #=> [{:message=>"foobar!",
211
+ # :user_id=>"99999",
212
+ # :person=>"Brandon",
213
+ # :id=>"18659245",
214
+ # :timestamp=>=>Tue May 05 07:15:00 -0700 2009}]
215
+ #
216
+ # The timestamp slot will typically have a granularity of five minutes.
209
217
  #
210
218
  def transcript(transcript_date = Date.today)
211
- unless transcript_date.is_a?(Date)
212
- transcript_date = transcript_date.to_date
213
- end
214
219
  url = "/room/#{@id}/transcript/#{transcript_date.strftime('%Y/%m/%d')}.json"
215
220
  connection.get(url)['messages'].map do |message|
216
221
  parse_message(message)
@@ -303,5 +308,6 @@ module Tinder
303
308
  def connection
304
309
  @connection
305
310
  end
311
+
306
312
  end
307
313
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: UTF-8
2
2
  module Tinder
3
- VERSION = '1.9.4' unless defined?(::Tinder::VERSION)
3
+ VERSION = '1.10.0' unless defined?(::Tinder::VERSION)
4
4
  end
@@ -14,14 +14,14 @@ describe Tinder::Campfire do
14
14
  end
15
15
 
16
16
  it "should return rooms" do
17
- @campfire.rooms.size.should be == 2
18
- @campfire.rooms.first.should be_kind_of(Tinder::Room)
17
+ expect(@campfire.rooms.size).to eq(2)
18
+ expect(@campfire.rooms.first).to be_kind_of(Tinder::Room)
19
19
  end
20
20
 
21
21
  it "should set the room name and id" do
22
22
  room = @campfire.rooms.first
23
- room.name.should be == 'Room 1'
24
- room.id.should be == 80749
23
+ expect(room.name).to eq('Room 1')
24
+ expect(room.id).to eq(80749)
25
25
  end
26
26
  end
27
27
 
@@ -33,14 +33,14 @@ describe Tinder::Campfire do
33
33
  end
34
34
 
35
35
  it "should return rooms" do
36
- @campfire.presence.size.should be == 3
37
- @campfire.presence.first.should be_kind_of(Tinder::Room)
36
+ expect(@campfire.presence.size).to eq(3)
37
+ expect(@campfire.presence.first).to be_kind_of(Tinder::Room)
38
38
  end
39
39
 
40
40
  it "should set the room name and id" do
41
41
  room = @campfire.presence.last
42
- room.name.should be == 'Room 3'
43
- room.id.should be == 80754
42
+ expect(room.name).to eq('Room 3')
43
+ expect(room.id).to eq(80754)
44
44
  end
45
45
  end
46
46
 
@@ -53,12 +53,12 @@ describe Tinder::Campfire do
53
53
 
54
54
  it "should return a Tinder::Room object when a match is found" do
55
55
  room = @campfire.find_room_by_id 80749
56
- room.should be_kind_of(Tinder::Room)
56
+ expect(room).to be_kind_of(Tinder::Room)
57
57
  end
58
58
 
59
59
  it "should return nil when no match is found" do
60
60
  room = @campfire.find_room_by_id 123
61
- room.should be nil
61
+ expect(room).to eq(nil)
62
62
  end
63
63
  end
64
64
 
@@ -71,12 +71,12 @@ describe Tinder::Campfire do
71
71
 
72
72
  it "should return a Tinder::Room object when a match is found" do
73
73
  room = @campfire.find_room_by_name 'Room 1'
74
- room.should be_kind_of(Tinder::Room)
74
+ expect(room).to be_kind_of(Tinder::Room)
75
75
  end
76
76
 
77
77
  it "should return nil when no match is found" do
78
78
  room = @campfire.find_room_by_name 'asdf'
79
- room.should be nil
79
+ expect(room).to eq(nil)
80
80
  end
81
81
  end
82
82
 
@@ -92,9 +92,9 @@ describe Tinder::Campfire do
92
92
  end
93
93
 
94
94
  it "should return a sorted list of users in all rooms" do
95
- @campfire.users.length.should be == 2
96
- @campfire.users.first[:name].should be == "Jane Doe"
97
- @campfire.users.last[:name].should be == "John Doe"
95
+ expect(@campfire.users.length).to eq(2)
96
+ expect(@campfire.users.first[:name]).to eq("Jane Doe")
97
+ expect(@campfire.users.last[:name]).to eq("John Doe")
98
98
  end
99
99
  end
100
100
 
@@ -106,7 +106,7 @@ describe Tinder::Campfire do
106
106
  end
107
107
 
108
108
  it "should return the current user's information" do
109
- @campfire.me["name"].should be == "John Doe"
109
+ expect(@campfire.me["name"]).to eq("John Doe")
110
110
  end
111
111
  end
112
112
  end
@@ -9,7 +9,7 @@ describe Tinder::Connection do
9
9
  end
10
10
 
11
11
  connection = Tinder::Connection.new('test', :token => 'foo')
12
- lambda { connection.get('/rooms.json') }.should raise_error(Tinder::AuthenticationFailed)
12
+ expect { connection.get('/rooms.json') }.to raise_error(Tinder::AuthenticationFailed)
13
13
  end
14
14
 
15
15
  it "should raise an exception when an invalid subdomain is specified" do
@@ -18,7 +18,7 @@ describe Tinder::Connection do
18
18
  end
19
19
 
20
20
  connection = Tinder::Connection.new('test', :token => 'foo')
21
- lambda { connection.get('/rooms.json') }.should raise_error(Tinder::AuthenticationFailed)
21
+ expect { connection.get('/rooms.json') }.to raise_error(Tinder::AuthenticationFailed)
22
22
  end
23
23
 
24
24
  it "should lookup token when username/password provided" do
@@ -27,7 +27,7 @@ describe Tinder::Connection do
27
27
  end
28
28
 
29
29
  connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass')
30
- connection.token.should == "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
30
+ expect(connection.token).to eq("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
31
31
  end
32
32
 
33
33
  it "should use basic auth for credentials" do
@@ -35,7 +35,7 @@ describe Tinder::Connection do
35
35
  stub.get("/rooms.json") {[200, {}, fixture('rooms.json')]}
36
36
  end
37
37
  connection = Tinder::Connection.new('test', :token => 'mytoken')
38
- lambda { connection.get('/rooms.json') }.should_not raise_error
38
+ expect { connection.get('/rooms.json') }.not_to raise_error
39
39
  end
40
40
 
41
41
  end
@@ -51,17 +51,17 @@ describe Tinder::Connection do
51
51
  end
52
52
 
53
53
  it "should authenticate" do
54
- lambda { connection.get('/rooms.json') }.should_not raise_error
54
+ expect { connection.get('/rooms.json') }.to_not raise_error
55
55
  end
56
56
 
57
57
  it "should set the oauth_token" do
58
58
  connection.get('/rooms.json')
59
- connection.options[:oauth_token].should == oauth_token
59
+ expect(connection.options[:oauth_token]).to eq(oauth_token)
60
60
  end
61
61
 
62
62
  it "should set an Authorization header" do
63
63
  connection.get('/rooms.json')
64
- connection.connection.headers["Authorization"].should == "Bearer #{oauth_token}"
64
+ expect(connection.connection.headers["Authorization"]).to eq("Bearer #{oauth_token}")
65
65
  end
66
66
 
67
67
  end
@@ -73,7 +73,7 @@ describe Tinder::Connection do
73
73
  end
74
74
 
75
75
  connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass')
76
- connection.ssl?.should be_true
76
+ expect(connection.ssl?).to eq(true)
77
77
  end
78
78
 
79
79
  it "should should allow peer verification to be turned off" do
@@ -82,7 +82,7 @@ describe Tinder::Connection do
82
82
  end
83
83
 
84
84
  connection = Tinder::Connection.new('test', :username => 'user', :password => 'pass', :ssl_verify => false)
85
- connection.connection.ssl[:verify].should be == false
85
+ expect(connection.connection.ssl.verify?).to eq(false)
86
86
  end
87
87
 
88
88
  it "should allow passing any ssl_options to Faraday" do
@@ -98,7 +98,7 @@ describe Tinder::Connection do
98
98
  :ca_file => "/etc/ssl/custom"
99
99
  }
100
100
  )
101
- connection.connection.ssl.should eql(:verify => false, :ca_path => "/usr/lib/ssl/certs", :ca_file => "/etc/ssl/custom")
101
+ expect(connection.connection.ssl.to_hash).to eq(:verify => false, :ca_path => "/usr/lib/ssl/certs", :ca_file => "/etc/ssl/custom")
102
102
  end
103
103
  end
104
104
  end
@@ -3,6 +3,13 @@ require 'spec_helper'
3
3
  require 'date'
4
4
 
5
5
  describe Tinder::Room do
6
+
7
+ def mock_listen_callbacks(stream)
8
+ expect(stream).to receive(:each_item).with(any_args).and_return(true)
9
+ expect(stream).to receive(:on_error)
10
+ expect(stream).to receive(:on_max_reconnects)
11
+ end
12
+
6
13
  before do
7
14
  @connection = Tinder::Connection.new('test', :token => 'mytoken')
8
15
 
@@ -15,11 +22,9 @@ describe Tinder::Room do
15
22
  # Get EventMachine out of the way. We could be using em-spec, but seems like overkill
16
23
  require 'twitter/json_stream'
17
24
  module EventMachine; def self.run; yield end end
18
- EventMachine.stub(:reactor_running?).and_return(true)
25
+ expect(EventMachine).to receive(:reactor_running?).at_most(:once).and_return(true)
26
+
19
27
  @stream = double(Twitter::JSONStream)
20
- @stream.stub(:each_item)
21
- @stream.stub(:on_error)
22
- @stream.stub(:on_max_reconnects)
23
28
  end
24
29
 
25
30
  describe "join" do
@@ -46,7 +51,7 @@ describe Tinder::Room do
46
51
  end
47
52
 
48
53
  it "stops listening" do
49
- @room.should_receive(:stop_listening)
54
+ expect(@room).to receive(:stop_listening)
50
55
  @room.leave
51
56
  end
52
57
  end
@@ -71,14 +76,14 @@ describe Tinder::Room do
71
76
  end
72
77
 
73
78
  it "should GET the search endpoint with the search term and filter by room" do
74
- @room.stub(:id).and_return(490096)
75
- @room.should_receive(:parse_message).exactly(2).times
79
+ expect(@room).to receive(:id).twice.and_return(490096)
80
+ expect(@room).to receive(:parse_message).exactly(2).times
76
81
  @room.search("foo")
77
82
  end
78
83
 
79
84
  it "should return empty array if no messages in room" do
80
- @room.should_receive(:parse_message).never
81
- @room.search("foo").should be_empty
85
+ expect(@room).not_to receive(:parse_message)
86
+ expect(@room.search("foo")).to be_empty
82
87
  end
83
88
  end
84
89
 
@@ -87,7 +92,7 @@ describe Tinder::Room do
87
92
  stub_connection(@connection) do |stub|
88
93
  stub.get('/room/80749/transcript/2012/10/15.json') {[200, {}, fixture("rooms/recent.json")]}
89
94
  end
90
- @room.should_receive(:parse_message).exactly(2).times
95
+ expect(@room).to receive(:parse_message).exactly(2).times
91
96
  @room.transcript(Date.parse('2012-10-15'))
92
97
  end
93
98
 
@@ -95,10 +100,35 @@ describe Tinder::Room do
95
100
  stub_connection(@connection) do |stub|
96
101
  stub.get('/room/80749/transcript/1981/03/21.json') {[200, {}, fixture("rooms/recent.json")]}
97
102
  end
98
- Date.stub(:today).and_return(Date.parse('1981-03-21'))
99
- @room.should_receive(:parse_message).exactly(2).times
103
+ expect(Date).to receive(:today).and_return(Date.parse('1981-03-21'))
104
+ expect(@room).to receive(:parse_message).exactly(2).times
100
105
  @room.transcript
101
106
  end
107
+
108
+ it "should return an array of messages" do
109
+ stub_connection(@connection) do |stub|
110
+ stub.get('/room/80749/transcript/2012/10/15.json') {[200, {}, fixture('rooms/recent.json')]}
111
+ stub.get('/users/1158839.json') {[200, {}, fixture('users/me.json')]}
112
+ stub.get('/users/1158837.json') {[200, {}, fixture('users/me.json')]}
113
+ end
114
+
115
+ expect(@room.transcript(Date.parse('2012-10-15'))).to be_a(Array)
116
+ end
117
+
118
+ it "should have messages with attributes" do
119
+ stub_connection(@connection) do |stub|
120
+ stub.get('/room/80749/transcript/2012/10/15.json') {[200, {}, fixture("rooms/recent.json")]}
121
+ stub.get('/users/1158839.json') {[200, {}, fixture('users/me.json')]}
122
+ stub.get('/users/1158837.json') {[200, {}, fixture('users/me.json')]}
123
+ end
124
+
125
+ message = @room.transcript(Date.parse('2012-10-15')).first
126
+
127
+ expect(message[:id]).to be_a(Integer)
128
+ expect(message[:user][:id]).to be_a(Integer)
129
+ expect(message[:body]).to be_a(String)
130
+ expect(message[:created_at]).to be_a(Time)
131
+ end
102
132
  end
103
133
 
104
134
  describe "unlock" do
@@ -115,31 +145,32 @@ describe Tinder::Room do
115
145
 
116
146
  describe "guest_url" do
117
147
  it "should use guest_invite_code if active" do
118
- @room.stub(:guest_access_enabled? => true, :guest_invite_code => '123')
119
- @room.guest_url.should == "https://test.campfirenow.com/123"
148
+ expect(@room).to receive(:guest_access_enabled?).and_return(true)
149
+ expect(@room).to receive(:guest_invite_code).and_return('123')
150
+ expect(@room.guest_url).to eq("https://test.campfirenow.com/123")
120
151
  end
121
152
 
122
153
  it "should return nil when guest access is not enabled" do
123
- @room.stub(:guest_access_enabled?).and_return(false)
124
- @room.guest_url.should be_nil
154
+ expect(@room).to receive(:guest_access_enabled?).and_return(false)
155
+ expect(@room.guest_url).to be_nil
125
156
  end
126
157
  end
127
158
 
128
159
  it "should set guest_invite_code" do
129
- @room.guest_invite_code.should == "90cf7"
160
+ expect(@room.guest_invite_code).to eq("90cf7")
130
161
  end
131
162
 
132
163
  it "should set guest_access_enabled?" do
133
- @room.guest_access_enabled?.should be_true
164
+ expect(@room.guest_access_enabled?).to eq(true)
134
165
  end
135
166
 
136
167
  describe "topic" do
137
168
  it "should get the current topic" do
138
- @room.topic.should == "Testing"
169
+ expect(@room.topic).to eq("Testing")
139
170
  end
140
171
 
141
172
  it "should get the current topic even if it's changed" do
142
- @room.topic.should == "Testing"
173
+ expect(@room.topic).to eq("Testing")
143
174
 
144
175
  # reinitialize a new connection since we can't modify the
145
176
  # faraday stack after a request has already been submitted
@@ -150,7 +181,7 @@ describe Tinder::Room do
150
181
  stub.get('/room/80749.json') {[200, {}, fixture('rooms/room80751.json')]}
151
182
  end
152
183
 
153
- @room.topic.should == "Testing 2"
184
+ expect(@room.topic).to eq("Testing 2")
154
185
 
155
186
  end
156
187
  end
@@ -174,7 +205,7 @@ describe Tinder::Room do
174
205
  end
175
206
 
176
207
  it "should get from the streaming url" do
177
- Twitter::JSONStream.should_receive(:connect).with(
208
+ expect(Twitter::JSONStream).to receive(:connect).with(
178
209
  {
179
210
  :host=>"streaming.campfirenow.com",
180
211
  :path=>"/room/80749/live.json",
@@ -183,21 +214,22 @@ describe Tinder::Room do
183
214
  :ssl=>true
184
215
  }
185
216
  ).and_return(@stream)
186
-
217
+ mock_listen_callbacks(@stream)
187
218
  @room.listen { }
188
219
  end
189
220
 
190
221
  it "should raise an exception if no block is given" do
191
- lambda {
222
+ expect {
192
223
  @room.listen
193
- }.should raise_error(ArgumentError, "no block provided")
224
+ }.to raise_error(ArgumentError, "no block provided")
194
225
  end
195
226
 
196
227
  it "marks the room as listening" do
197
- Twitter::JSONStream.stub(:connect).and_return(@stream)
198
- lambda {
228
+ expect(Twitter::JSONStream).to receive(:connect).and_return(@stream)
229
+ mock_listen_callbacks(@stream)
230
+ expect {
199
231
  @room.listen { }
200
- }.should change(@room, :listening?).from(false).to(true)
232
+ }.to change(@room, :listening?).from(false).to(true)
201
233
  end
202
234
  end
203
235
 
@@ -207,24 +239,26 @@ describe Tinder::Room do
207
239
  stub.post('/room/80749/join.json') {[200, {}, ""]}
208
240
  end
209
241
 
210
- Twitter::JSONStream.stub(:connect).and_return(@stream)
211
- @stream.stub(:stop)
242
+ expect(Twitter::JSONStream).to receive(:connect).and_return(@stream)
243
+ expect(@stream).to receive(:stop)
212
244
  end
213
245
 
214
246
  it "changes a listening room to a non-listening room" do
247
+ mock_listen_callbacks(@stream)
215
248
  @room.listen { }
216
- lambda {
249
+ expect {
217
250
  @room.stop_listening
218
- }.should change(@room, :listening?).from(true).to(false)
251
+ }.to change(@room, :listening?).from(true).to(false)
219
252
  end
220
253
 
221
254
  it "tells the json stream to stop" do
255
+ mock_listen_callbacks(@stream)
222
256
  @room.listen { }
223
- @stream.should_receive(:stop)
224
257
  @room.stop_listening
225
258
  end
226
259
 
227
260
  it "does nothing if the room is not listening" do
261
+ mock_listen_callbacks(@stream)
228
262
  @room.listen { }
229
263
  @room.stop_listening
230
264
  @room.stop_listening
@@ -241,7 +275,7 @@ describe Tinder::Room do
241
275
  end
242
276
 
243
277
  it "should get a list of parsed recent messages" do
244
- @room.should_receive(:parse_message).exactly(2).times
278
+ expect(@room).to receive(:parse_message).exactly(2).times
245
279
  messages = @room.recent
246
280
  end
247
281
  end
@@ -260,16 +294,16 @@ describe Tinder::Room do
260
294
  :body => 'An aunt is worth two nieces',
261
295
  :created_at => Time.parse('2012/02/14 16:21:00 +0000')
262
296
  }
263
- @room.stub(:user).with(123).and_return({ :name => 'Dr. Noodles' })
297
+ expect(@room).to receive(:user).with(123).and_return({ :name => 'Dr. Noodles' })
264
298
 
265
299
  actual = @room.parse_message(unparsed_message)
266
- actual.should == expected
300
+ expect(actual).to eq(expected)
267
301
  end
268
302
  end
269
303
 
270
304
  describe "user" do
271
305
  before do
272
- @room.stub(:current_users).and_return([
306
+ expect(@room).to receive(:current_users).and_return([
273
307
  { :id => 1, :name => 'The Amazing Crayon Executive'},
274
308
  { :id => 2, :name => 'Lord Pants'},
275
309
  ])
@@ -277,21 +311,21 @@ describe Tinder::Room do
277
311
  end
278
312
 
279
313
  it "looks up user if not already in room's cache" do
280
- @room.should_receive(:fetch_user).with(3).
314
+ expect(@room).to receive(:fetch_user).with(3).
281
315
  and_return(@not_current_user)
282
- @room.user(3).should == @not_current_user
316
+ expect(@room.user(3)).to eq(@not_current_user)
283
317
  end
284
318
 
285
319
  it "pulls user from room's cache if user in participant list" do
286
- @room.should_receive(:fetch_user).never
320
+ expect(@room).not_to receive(:fetch_user)
287
321
  user = @room.user(1)
288
322
  end
289
323
 
290
324
  it "adds user to cache after first lookup" do
291
- @room.should_receive(:fetch_user).with(3).at_most(:once).
325
+ expect(@room).to receive(:fetch_user).with(3).at_most(:once).
292
326
  and_return(@not_current_user)
293
- @room.user(3).should == @not_current_user
294
- @room.user(3).should == @not_current_user
327
+ expect(@room.user(3)).to eq(@not_current_user)
328
+ expect(@room.user(3)).to eq(@not_current_user)
295
329
  end
296
330
  end
297
331
 
@@ -303,28 +337,28 @@ describe Tinder::Room do
303
337
  end
304
338
 
305
339
  it "requests via GET and returns the requested user's information" do
306
- @room.fetch_user(5)['name'].should == 'John Doe'
340
+ expect(@room.fetch_user(5)['name']).to eq('John Doe')
307
341
  end
308
342
  end
309
343
 
310
344
  describe "current_users" do
311
345
  it "returns list of currently participating users" do
312
346
  current_users = @room.current_users
313
- current_users.size.should == 1
314
- current_users.first[:name].should == 'Brandon Keepers'
347
+ expect(current_users.size).to eq(1)
348
+ expect(current_users.first[:name]).to eq('Brandon Keepers')
315
349
  end
316
350
  end
317
351
 
318
352
  describe "users" do
319
353
  it "returns current users if cache has not been initialized yet" do
320
- @room.should_receive(:current_users).and_return(:the_whole_spittoon)
321
- @room.users.should == :the_whole_spittoon
354
+ expect(@room).to receive(:current_users).and_return(:the_whole_spittoon)
355
+ expect(@room.users).to eq(:the_whole_spittoon)
322
356
  end
323
357
 
324
358
  it "returns current users plus any added cached users" do
325
- @room.should_receive(:current_users).and_return([:mia_cuttlefish])
359
+ expect(@room).to receive(:current_users).and_return([:mia_cuttlefish])
326
360
  @room.users << :guy_wearing_new_mexico_as_a_hat
327
- @room.users.should == [:mia_cuttlefish, :guy_wearing_new_mexico_as_a_hat]
361
+ expect(@room.users).to eq([:mia_cuttlefish, :guy_wearing_new_mexico_as_a_hat])
328
362
  end
329
363
  end
330
364
  end
@@ -4,11 +4,11 @@ require 'tinder/version'
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.add_dependency 'eventmachine', '~> 1.0'
7
- gem.add_dependency 'faraday', '~> 0.8.9'
7
+ gem.add_dependency 'faraday', '~> 0.9.0'
8
8
  gem.add_dependency 'faraday_middleware', '~> 0.9'
9
9
  gem.add_dependency 'hashie', ['>= 1.0', '< 3']
10
10
  gem.add_dependency 'json', '~> 1.8.0'
11
- gem.add_dependency 'mime-types', '~> 1.19'
11
+ gem.add_dependency 'mime-types'
12
12
  gem.add_dependency 'multi_json', '~> 1.7'
13
13
  gem.add_dependency 'twitter-stream', '~> 0.1'
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinder
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Keepers
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-02-24 00:00:00.000000000 Z
13
+ date: 2014-08-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: eventmachine
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: 0.8.9
35
+ version: 0.9.0
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: 0.8.9
42
+ version: 0.9.0
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: faraday_middleware
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -92,16 +92,16 @@ dependencies:
92
92
  name: mime-types
93
93
  requirement: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '1.19'
97
+ version: '0'
98
98
  type: :runtime
99
99
  prerelease: false
100
100
  version_requirements: !ruby/object:Gem::Requirement
101
101
  requirements:
102
- - - "~>"
102
+ - - ">="
103
103
  - !ruby/object:Gem::Version
104
- version: '1.19'
104
+ version: '0'
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: multi_json
107
107
  requirement: !ruby/object:Gem::Requirement
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: 1.3.6
233
233
  requirements: []
234
234
  rubyforge_project:
235
- rubygems_version: 2.2.0
235
+ rubygems_version: 2.2.2
236
236
  signing_key:
237
237
  specification_version: 4
238
238
  summary: Ruby wrapper for the Campfire API