t 1.7.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/spec/set_spec.rb CHANGED
@@ -136,18 +136,18 @@ describe T::Set do
136
136
  end
137
137
  end
138
138
 
139
- describe "#url" do
139
+ describe "#website" do
140
140
  before do
141
141
  @set.options = @set.options.merge("profile" => fixture_path + "/.trc")
142
142
  stub_post("/1.1/account/update_profile.json").with(:body => {:url => "https://github.com/sferik"}).to_return(:body => fixture("sferik.json"))
143
143
  end
144
144
  it "requests the correct resource" do
145
- @set.url("https://github.com/sferik")
145
+ @set.website("https://github.com/sferik")
146
146
  expect(a_post("/1.1/account/update_profile.json").with(:body => {:url => "https://github.com/sferik"})).to have_been_made
147
147
  end
148
148
  it "has the correct output" do
149
- @set.url("https://github.com/sferik")
150
- expect($stdout.string.chomp).to eq "@testcli's URL has been updated."
149
+ @set.website("https://github.com/sferik")
150
+ expect($stdout.string.chomp).to eq "@testcli's website has been updated."
151
151
  end
152
152
  end
153
153
 
data/spec/stream_spec.rb CHANGED
@@ -3,8 +3,8 @@ require 'helper'
3
3
  describe T::Stream do
4
4
  let(:t_class) {
5
5
  klass = Class.new
6
- klass.stub(:options=).and_return
7
- klass.stub(:options).and_return({})
6
+ allow(klass).to receive(:options=).and_return
7
+ allow(klass).to receive(:options).and_return({})
8
8
  klass
9
9
  }
10
10
 
@@ -14,14 +14,11 @@ describe T::Stream do
14
14
 
15
15
  before :each do
16
16
  T::RCFile.instance.path = fixture_path + "/.trc"
17
-
18
- @tweetstream_client = stub('TweetStream::Client').as_null_object
19
-
17
+ @client = double('Twitter::Streaming::Client').as_null_object
20
18
  @stream = T::Stream.new
21
- @stream.stub(:client) { @tweetstream_client }
22
- @stream.stub(:say).and_return
23
-
24
- STDOUT.stub(:tty?).and_return(true)
19
+ allow(@stream).to receive(:client) { @client }
20
+ allow(@stream).to receive(:say).and_return
21
+ allow(STDOUT).to receive(:tty?).and_return(true)
25
22
  end
26
23
 
27
24
  describe "#all" do
@@ -29,21 +26,17 @@ describe T::Stream do
29
26
  before :each do
30
27
  @stream.options = @stream.options.merge("csv" => true)
31
28
  end
32
-
33
29
  it "outputs headings when the stream initializes" do
34
- @tweetstream_client.stub(:on_timeline_status).and_return
35
- @tweetstream_client.stub(:on_inited).and_yield
36
-
37
- @stream.should_receive(:say).with("ID,Posted at,Screen name,Text\n")
30
+ allow(@client).to receive(:sample).and_return
31
+ allow(@client).to receive(:before_request).and_yield
32
+ expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
38
33
  @stream.all
39
34
  end
40
-
41
35
  it "outputs in CSV format" do
42
- @tweetstream_client.stub(:on_inited).and_return
43
- @tweetstream_client.stub(:on_timeline_status).
36
+ allow(@client).to receive(:before_request).and_return
37
+ allow(@client).to receive(:sample).
44
38
  and_yield(@status)
45
-
46
- @stream.should_receive(:print_csv_tweet).with(any_args)
39
+ expect(@stream).to receive(:print_csv_tweet).with(any_args)
47
40
  @stream.all
48
41
  end
49
42
  end
@@ -54,61 +47,59 @@ describe T::Stream do
54
47
  end
55
48
 
56
49
  it "outputs headings when the stream initializes" do
57
- @tweetstream_client.stub(:on_inited).and_yield
58
- @tweetstream_client.stub(:on_timeline_status).and_return
59
-
60
- @stream.should_receive(:print_table).with(any_args)
50
+ allow(@client).to receive(:before_request).and_yield
51
+ allow(@client).to receive(:sample).and_return
52
+ expect(@stream).to receive(:print_table).with(any_args)
61
53
  @stream.all
62
54
  end
63
55
 
64
56
  it "outputs in long text format" do
65
- @tweetstream_client.stub(:on_inited).and_return
66
- @tweetstream_client.stub(:on_timeline_status).
57
+ allow(@client).to receive(:before_request).and_return
58
+ allow(@client).to receive(:sample).
67
59
  and_yield(@status)
68
-
69
- @stream.should_receive(:print_table).with(any_args)
60
+ expect(@stream).to receive(:print_table).with(any_args)
70
61
  @stream.all
71
62
  end
72
63
  end
73
64
 
74
65
  context "normal usage" do
75
66
  before :each do
76
- @tweetstream_client.stub(:on_timeline_status).
67
+ allow(@client).to receive(:sample).
77
68
  and_yield(@status)
78
69
  end
79
70
 
80
71
  it "prints the tweet status" do
81
- @stream.should_receive(:print_message)
72
+ expect(@stream).to receive(:print_message)
82
73
  @stream.all
83
74
  end
84
75
  end
85
76
 
86
- it "invokes TweetStream::Client#sample" do
87
- @tweetstream_client.should_receive(:sample)
77
+ it "invokes Twitter::Streaming::Client#sample" do
78
+ expect(@client).to receive(:sample)
88
79
  @stream.all
89
80
  end
90
81
  end
91
82
 
92
83
  describe "#matrix" do
93
84
  before :each do
94
- @tweetstream_client.stub(:on_timeline_status).
85
+ allow(@client).to receive(:sample).
95
86
  and_yield(@status)
96
87
  end
97
88
 
98
89
  it "outputs the tweet status" do
99
- @stream.should_receive(:say).with(any_args)
90
+ expect(@stream).to receive(:say).with(any_args)
100
91
  @stream.matrix
101
92
  end
102
93
 
103
- it "invokes TweetStream::Client.sample" do
104
- @tweetstream_client.should_receive(:sample)
94
+ it "invokes Twitter::Streaming::Client.sample" do
95
+ expect(@client).to receive(:sample)
105
96
  @stream.matrix
106
97
  end
107
98
  end
108
99
 
109
100
  describe "#search" do
110
101
  before :each do
111
- @tweetstream_client.stub(:on_timeline_status).
102
+ allow(@client).to receive(:filter).with(:track => ["gem"]).
112
103
  and_yield(@status)
113
104
  end
114
105
 
@@ -118,10 +109,9 @@ describe T::Stream do
118
109
  end
119
110
 
120
111
  it "outputs in CSV format" do
121
- @tweetstream_client.stub(:on_inited).and_return
122
-
123
- @stream.should_receive(:print_csv_tweet).with(any_args)
124
- @stream.search('t gem')
112
+ allow(@client).to receive(:before_request).and_return
113
+ expect(@stream).to receive(:print_csv_tweet).with(any_args)
114
+ @stream.search('gem')
125
115
  end
126
116
  end
127
117
 
@@ -131,48 +121,43 @@ describe T::Stream do
131
121
  end
132
122
 
133
123
  it "outputs in long text format" do
134
- @tweetstream_client.stub(:on_inited).and_return
135
- @tweetstream_client.stub(:on_timeline_status).
124
+ allow(@client).to receive(:before_request).and_return
125
+ allow(@client).to receive(:filter).with(:track => ["gem"]).
136
126
  and_yield(@status)
137
-
138
- @stream.should_receive(:print_table).with(any_args)
139
- @stream.search('t gem')
127
+ expect(@stream).to receive(:print_table).with(any_args)
128
+ @stream.search('gem')
140
129
  end
141
130
  end
142
131
 
143
132
  context "normal usage" do
144
133
  before :each do
145
- @tweetstream_client.stub(:on_timeline_status).
134
+ allow(@client).to receive(:filter).with(:track => ["gem"]).
146
135
  and_yield(@status)
147
136
  end
148
-
149
137
  it "prints the tweet status" do
150
- @stream.should_receive(:print_message)
151
- @stream.search('t gem')
138
+ expect(@stream).to receive(:print_message)
139
+ @stream.search('gem')
152
140
  end
153
141
  end
154
142
 
155
143
  it "performs a REST search when the stream initializes" do
156
- @tweetstream_client.stub(:on_timeline_status).and_return
157
- @tweetstream_client.stub(:on_inited).and_yield
158
-
159
- T::Search.stub(:new).and_return(t_class)
160
- t_class.should_receive(:all).with('t OR gem').and_return
161
-
144
+ allow(@client).to receive(:filter).and_return
145
+ allow(@client).to receive(:before_request).and_yield
146
+ allow(T::Search).to receive(:new).and_return(t_class)
147
+ expect(t_class).to receive(:all).with('t OR gem').and_return
162
148
  @stream.search('t', 'gem')
163
149
  end
164
150
 
165
- it "invokes TweetStream::Client#track" do
166
- @tweetstream_client.stub(:on_timeline_status).and_return
167
-
168
- @tweetstream_client.should_receive(:track).with(['t gem'])
169
- @stream.search('t gem')
151
+ it "invokes Twitter::Streaming::Client#filter" do
152
+ allow(@client).to receive(:filter).and_return
153
+ expect(@client).to receive(:filter).with(:track => ['gem'])
154
+ @stream.search('gem')
170
155
  end
171
156
  end
172
157
 
173
158
  describe "#timeline" do
174
159
  before :each do
175
- @tweetstream_client.stub(:on_timeline_status).
160
+ allow(@client).to receive(:user).
176
161
  and_yield(@status)
177
162
  end
178
163
 
@@ -182,9 +167,8 @@ describe T::Stream do
182
167
  end
183
168
 
184
169
  it "outputs in CSV format" do
185
- @tweetstream_client.stub(:on_inited).and_return
186
-
187
- @stream.should_receive(:print_csv_tweet).with(any_args)
170
+ allow(@client).to receive(:before_request).and_return
171
+ expect(@stream).to receive(:print_csv_tweet).with(any_args)
188
172
  @stream.timeline
189
173
  end
190
174
  end
@@ -195,48 +179,45 @@ describe T::Stream do
195
179
  end
196
180
 
197
181
  it "outputs in long text format" do
198
- @tweetstream_client.stub(:on_inited).and_return
199
- @tweetstream_client.stub(:on_timeline_status).
182
+ allow(@client).to receive(:before_request).and_return
183
+ allow(@client).to receive(:user).
200
184
  and_yield(@status)
201
-
202
- @stream.should_receive(:print_table).with(any_args)
185
+ expect(@stream).to receive(:print_table).with(any_args)
203
186
  @stream.timeline
204
187
  end
205
188
  end
206
189
 
207
190
  context "normal usage" do
208
191
  before :each do
209
- @tweetstream_client.stub(:on_timeline_status).
192
+ allow(@client).to receive(:user).
210
193
  and_yield(@status)
211
194
  end
212
195
 
213
196
  it "prints the tweet status" do
214
- @stream.should_receive(:print_message)
197
+ expect(@stream).to receive(:print_message)
215
198
  @stream.timeline
216
199
  end
217
200
  end
218
201
 
219
202
  it "performs a REST search when the stream initializes" do
220
- @tweetstream_client.stub(:on_timeline_status).and_return
221
- @tweetstream_client.stub(:on_inited).and_yield
222
-
223
- T::CLI.stub(:new).and_return(t_class)
224
- t_class.should_receive(:timeline).and_return
203
+ allow(@client).to receive(:user).and_return
204
+ allow(@client).to receive(:before_request).and_yield
205
+ allow(T::CLI).to receive(:new).and_return(t_class)
206
+ expect(t_class).to receive(:timeline).and_return
225
207
 
226
208
  @stream.timeline
227
209
  end
228
210
 
229
- it "invokes TweetStream::Client#userstream" do
230
- @tweetstream_client.stub(:on_timeline_status).and_return
231
-
232
- @tweetstream_client.should_receive(:userstream)
211
+ it "invokes Twitter::Streaming::Client#userstream" do
212
+ allow(@client).to receive(:user).and_return
213
+ expect(@client).to receive(:user)
233
214
  @stream.timeline
234
215
  end
235
216
  end
236
217
 
237
218
  describe "#users" do
238
219
  before :each do
239
- @tweetstream_client.stub(:on_timeline_status).
220
+ allow(@client).to receive(:follow).
240
221
  and_yield(@status)
241
222
  end
242
223
 
@@ -246,17 +227,15 @@ describe T::Stream do
246
227
  end
247
228
 
248
229
  it "outputs headings when the stream initializes" do
249
- @tweetstream_client.stub(:on_timeline_status).and_return
250
- @tweetstream_client.stub(:on_inited).and_yield
251
-
252
- @stream.should_receive(:say).with("ID,Posted at,Screen name,Text\n")
230
+ allow(@client).to receive(:follow).and_return
231
+ allow(@client).to receive(:before_request).and_yield
232
+ expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
253
233
  @stream.users('123')
254
234
  end
255
235
 
256
236
  it "outputs in CSV format" do
257
- @tweetstream_client.stub(:on_inited).and_return
258
-
259
- @stream.should_receive(:print_csv_tweet).with(any_args)
237
+ allow(@client).to receive(:before_request).and_return
238
+ expect(@stream).to receive(:print_csv_tweet).with(any_args)
260
239
  @stream.users('123')
261
240
  end
262
241
  end
@@ -267,39 +246,36 @@ describe T::Stream do
267
246
  end
268
247
 
269
248
  it "outputs headings when the stream initializes" do
270
- @tweetstream_client.stub(:on_inited).and_yield
271
- @tweetstream_client.stub(:on_timeline_status).and_return
272
-
273
- @stream.should_receive(:print_table).with(any_args)
249
+ allow(@client).to receive(:before_request).and_yield
250
+ allow(@client).to receive(:follow).and_return
251
+ expect(@stream).to receive(:print_table).with(any_args)
274
252
  @stream.users('123')
275
253
  end
276
254
 
277
255
  it "outputs in long text format" do
278
- @tweetstream_client.stub(:on_inited).and_return
279
- @tweetstream_client.stub(:on_timeline_status).
256
+ allow(@client).to receive(:before_request).and_return
257
+ allow(@client).to receive(:follow).
280
258
  and_yield(@status)
281
-
282
- @stream.should_receive(:print_table).with(any_args)
259
+ expect(@stream).to receive(:print_table).with(any_args)
283
260
  @stream.users('123')
284
261
  end
285
262
  end
286
263
 
287
264
  context "normal usage" do
288
265
  before :each do
289
- @tweetstream_client.stub(:on_timeline_status).
266
+ allow(@client).to receive(:follow).
290
267
  and_yield(@status)
291
268
  end
292
269
 
293
270
  it "prints the tweet status" do
294
- @stream.should_receive(:print_message)
271
+ expect(@stream).to receive(:print_message)
295
272
  @stream.users('123')
296
273
  end
297
274
  end
298
275
 
299
- it "invokes TweetStream::Client#follow" do
300
- @tweetstream_client.stub(:on_timeline_status).and_return
301
-
302
- @tweetstream_client.should_receive(:follow).with([123, 456, 789])
276
+ it "invokes Twitter::Streaming::Client#follow" do
277
+ allow(@client).to receive(:follow).and_return
278
+ expect(@client).to receive(:follow).with([123, 456, 789])
303
279
  @stream.users('123', '456', '789')
304
280
  end
305
281
  end
data/t.gemspec CHANGED
@@ -5,19 +5,17 @@ require 't/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.add_dependency 'launchy', '~> 2.3'
8
- spec.add_dependency 'fastercsv', '~> 1.5'
9
8
  spec.add_dependency 'geokit', '~> 1.6'
10
9
  spec.add_dependency 'htmlentities', '~> 4.3'
11
10
  spec.add_dependency 'oauth', '~> 0.4'
12
- spec.add_dependency 'oj', '~> 2.0'
13
11
  spec.add_dependency 'retryable', '~> 1.2'
14
12
  spec.add_dependency 'thor', ['>= 0.18.1', '< 2']
15
- spec.add_dependency 'tweetstream', '~> 2.3'
16
- spec.add_dependency 'twitter', '~> 4.4'
13
+ spec.add_dependency 'twitter', '~> 5.0'
17
14
  spec.add_development_dependency 'bundler', '~> 1.0'
18
15
  spec.author = "Erik Michaels-Ober"
19
16
  spec.bindir = 'bin'
20
17
  spec.cert_chain = ['certs/sferik.pem']
18
+ spec.date = '2013-11-18'
21
19
  spec.description = %q{A command-line power tool for Twitter.}
22
20
  spec.email = 'sferik@gmail.com'
23
21
  spec.executables = %w(t)
@@ -29,7 +27,8 @@ Gem::Specification.new do |spec|
29
27
  spec.licenses = ['MIT']
30
28
  spec.name = 't'
31
29
  spec.require_paths = ['lib']
32
- spec.required_rubygems_version = '>= 1.3.6'
30
+ spec.required_ruby_version = '>= 1.9.2'
31
+ spec.required_rubygems_version = '>= 1.3.5'
33
32
  spec.signing_key = File.expand_path("~/.gem/private_key.pem") if $0 =~ /gem\z/
34
33
  spec.summary = %q{CLI for Twitter}
35
34
  spec.test_files = Dir.glob("spec/**/*")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: t
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 2.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  U0xxV3ZRUnNCbHlwSGZoczZKSnVMbHlaUEdoVTNSL3YKU2YzbFZLcEJDV2dS
37
37
  cEdUdnk0NVhWcEIrNTl5MzNQSm1FdVExUFRFT1l2UXlhbzlVS01BQWFBTi83
38
38
  cVdRdGpsMApobHc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
39
- date: 2013-05-04 00:00:00.000000000 Z
39
+ date: 2013-11-18 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: launchy
@@ -54,22 +54,6 @@ dependencies:
54
54
  - - ~>
55
55
  - !ruby/object:Gem::Version
56
56
  version: '2.3'
57
- - !ruby/object:Gem::Dependency
58
- name: fastercsv
59
- requirement: !ruby/object:Gem::Requirement
60
- none: false
61
- requirements:
62
- - - ~>
63
- - !ruby/object:Gem::Version
64
- version: '1.5'
65
- type: :runtime
66
- prerelease: false
67
- version_requirements: !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- version: '1.5'
73
57
  - !ruby/object:Gem::Dependency
74
58
  name: geokit
75
59
  requirement: !ruby/object:Gem::Requirement
@@ -118,22 +102,6 @@ dependencies:
118
102
  - - ~>
119
103
  - !ruby/object:Gem::Version
120
104
  version: '0.4'
121
- - !ruby/object:Gem::Dependency
122
- name: oj
123
- requirement: !ruby/object:Gem::Requirement
124
- none: false
125
- requirements:
126
- - - ~>
127
- - !ruby/object:Gem::Version
128
- version: '2.0'
129
- type: :runtime
130
- prerelease: false
131
- version_requirements: !ruby/object:Gem::Requirement
132
- none: false
133
- requirements:
134
- - - ~>
135
- - !ruby/object:Gem::Version
136
- version: '2.0'
137
105
  - !ruby/object:Gem::Dependency
138
106
  name: retryable
139
107
  requirement: !ruby/object:Gem::Requirement
@@ -172,22 +140,6 @@ dependencies:
172
140
  - - <
173
141
  - !ruby/object:Gem::Version
174
142
  version: '2'
175
- - !ruby/object:Gem::Dependency
176
- name: tweetstream
177
- requirement: !ruby/object:Gem::Requirement
178
- none: false
179
- requirements:
180
- - - ~>
181
- - !ruby/object:Gem::Version
182
- version: '2.3'
183
- type: :runtime
184
- prerelease: false
185
- version_requirements: !ruby/object:Gem::Requirement
186
- none: false
187
- requirements:
188
- - - ~>
189
- - !ruby/object:Gem::Version
190
- version: '2.3'
191
143
  - !ruby/object:Gem::Dependency
192
144
  name: twitter
193
145
  requirement: !ruby/object:Gem::Requirement
@@ -195,7 +147,7 @@ dependencies:
195
147
  requirements:
196
148
  - - ~>
197
149
  - !ruby/object:Gem::Version
198
- version: '4.4'
150
+ version: '5.0'
199
151
  type: :runtime
200
152
  prerelease: false
201
153
  version_requirements: !ruby/object:Gem::Requirement
@@ -203,7 +155,7 @@ dependencies:
203
155
  requirements:
204
156
  - - ~>
205
157
  - !ruby/object:Gem::Version
206
- version: '4.4'
158
+ version: '5.0'
207
159
  - !ruby/object:Gem::Dependency
208
160
  name: bundler
209
161
  requirement: !ruby/object:Gem::Requirement
@@ -238,6 +190,7 @@ files:
238
190
  - lib/t/core_ext/kernel.rb
239
191
  - lib/t/core_ext/string.rb
240
192
  - lib/t/delete.rb
193
+ - lib/t/editor.rb
241
194
  - lib/t/list.rb
242
195
  - lib/t/printable.rb
243
196
  - lib/t/rcfile.rb
@@ -250,12 +203,13 @@ files:
250
203
  - lib/t.rb
251
204
  - spec/cli_spec.rb
252
205
  - spec/delete_spec.rb
206
+ - spec/editor_spec.rb
253
207
  - spec/fixtures/200_direct_messages.json
254
208
  - spec/fixtures/200_statuses.json
255
209
  - spec/fixtures/501_ids.json
256
210
  - spec/fixtures/501_users_list.json
257
211
  - spec/fixtures/access_token
258
- - spec/fixtures/activity_summary.json
212
+ - spec/fixtures/bearer_token.json
259
213
  - spec/fixtures/checkip.html
260
214
  - spec/fixtures/direct_message.json
261
215
  - spec/fixtures/direct_messages.json
@@ -317,13 +271,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
317
271
  requirements:
318
272
  - - ! '>='
319
273
  - !ruby/object:Gem::Version
320
- version: '0'
274
+ version: 1.9.2
321
275
  required_rubygems_version: !ruby/object:Gem::Requirement
322
276
  none: false
323
277
  requirements:
324
278
  - - ! '>='
325
279
  - !ruby/object:Gem::Version
326
- version: 1.3.6
280
+ version: 1.3.5
327
281
  requirements: []
328
282
  rubyforge_project:
329
283
  rubygems_version: 1.8.23
@@ -333,12 +287,13 @@ summary: CLI for Twitter
333
287
  test_files:
334
288
  - spec/cli_spec.rb
335
289
  - spec/delete_spec.rb
290
+ - spec/editor_spec.rb
336
291
  - spec/fixtures/200_direct_messages.json
337
292
  - spec/fixtures/200_statuses.json
338
293
  - spec/fixtures/501_ids.json
339
294
  - spec/fixtures/501_users_list.json
340
295
  - spec/fixtures/access_token
341
- - spec/fixtures/activity_summary.json
296
+ - spec/fixtures/bearer_token.json
342
297
  - spec/fixtures/checkip.html
343
298
  - spec/fixtures/direct_message.json
344
299
  - spec/fixtures/direct_messages.json
@@ -388,4 +343,3 @@ test_files:
388
343
  - spec/set_spec.rb
389
344
  - spec/stream_spec.rb
390
345
  - spec/utils_spec.rb
391
- has_rdoc: