t 2.0.1 → 2.0.2
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.tar.gz.sig +0 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +12 -12
- data/Rakefile +11 -1
- data/bin/t +11 -11
- data/lib/t.rb +7 -9
- data/lib/t/cli.rb +299 -360
- data/lib/t/collectable.rb +2 -4
- data/lib/t/core_ext/kernel.rb +3 -5
- data/lib/t/core_ext/string.rb +4 -6
- data/lib/t/delete.rb +27 -29
- data/lib/t/editor.rb +1 -3
- data/lib/t/list.rb +44 -45
- data/lib/t/printable.rb +43 -44
- data/lib/t/rcfile.rb +4 -5
- data/lib/t/requestable.rb +1 -3
- data/lib/t/search.rb +42 -55
- data/lib/t/set.rb +11 -12
- data/lib/t/stream.rb +24 -20
- data/lib/t/utils.rb +20 -28
- data/lib/t/version.rb +1 -3
- data/spec/cli_spec.rb +1241 -1242
- data/spec/delete_spec.rb +122 -122
- data/spec/editor_spec.rb +42 -42
- data/spec/fixtures/lists.json +1 -1
- data/spec/fixtures/locations.json +1 -1
- data/spec/helper.rb +17 -13
- data/spec/list_spec.rb +202 -202
- data/spec/rcfile_spec.rb +73 -73
- data/spec/search_spec.rb +398 -398
- data/spec/set_spec.rb +72 -72
- data/spec/stream_spec.rb +56 -56
- data/spec/utils_spec.rb +29 -29
- data/t.gemspec +1 -1
- metadata +56 -32
- metadata.gz.sig +0 -0
- checksums.yaml +0 -7
- checksums.yaml.gz.sig +0 -0
data/spec/set_spec.rb
CHANGED
@@ -4,7 +4,7 @@ require 'helper'
|
|
4
4
|
describe T::Set do
|
5
5
|
|
6
6
|
before :each do
|
7
|
-
T::RCFile.instance.path = fixture_path +
|
7
|
+
T::RCFile.instance.path = fixture_path + '/.trc'
|
8
8
|
@set = T::Set.new
|
9
9
|
@old_stderr = $stderr
|
10
10
|
$stderr = StringIO.new
|
@@ -18,135 +18,135 @@ describe T::Set do
|
|
18
18
|
$stdout = @old_stdout
|
19
19
|
end
|
20
20
|
|
21
|
-
describe
|
21
|
+
describe '#active' do
|
22
22
|
before do
|
23
|
-
@set.options = @set.options.merge(
|
23
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc_set')
|
24
24
|
end
|
25
|
-
it
|
26
|
-
@set.active(
|
27
|
-
expect($stdout.string.chomp).to eq
|
25
|
+
it 'has the correct output' do
|
26
|
+
@set.active('testcli', 'abc123')
|
27
|
+
expect($stdout.string.chomp).to eq 'Active account has been updated to testcli.'
|
28
28
|
end
|
29
|
-
it
|
30
|
-
@set.active(
|
31
|
-
expect($stdout.string.chomp).to eq
|
29
|
+
it 'accepts an account name without a consumer key' do
|
30
|
+
@set.active('testcli')
|
31
|
+
expect($stdout.string.chomp).to eq 'Active account has been updated to testcli.'
|
32
32
|
end
|
33
|
-
it
|
34
|
-
@set.active(
|
35
|
-
expect($stdout.string.chomp).to eq
|
33
|
+
it 'is case insensitive' do
|
34
|
+
@set.active('TestCLI', 'abc123')
|
35
|
+
expect($stdout.string.chomp).to eq 'Active account has been updated to testcli.'
|
36
36
|
end
|
37
|
-
it
|
37
|
+
it 'raises an error if username is ambiguous' do
|
38
38
|
expect do
|
39
|
-
@set.active(
|
39
|
+
@set.active('test', 'abc123')
|
40
40
|
end.to raise_error(ArgumentError, /Username test is ambiguous/)
|
41
41
|
end
|
42
|
-
it
|
42
|
+
it 'raises an error if the username is not found' do
|
43
43
|
expect do
|
44
|
-
@set.active(
|
44
|
+
@set.active('clitest')
|
45
45
|
end.to raise_error(ArgumentError, /Username clitest is not found/)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
-
describe
|
49
|
+
describe '#bio' do
|
50
50
|
before do
|
51
|
-
@set.options = @set.options.merge(
|
52
|
-
stub_post(
|
51
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
52
|
+
stub_post('/1.1/account/update_profile.json').with(:body => {:description => 'Vagabond.'}).to_return(:body => fixture('sferik.json'))
|
53
53
|
end
|
54
|
-
it
|
55
|
-
@set.bio(
|
56
|
-
expect(a_post(
|
54
|
+
it 'requests the correct resource' do
|
55
|
+
@set.bio('Vagabond.')
|
56
|
+
expect(a_post('/1.1/account/update_profile.json').with(:body => {:description => 'Vagabond.'})).to have_been_made
|
57
57
|
end
|
58
|
-
it
|
59
|
-
@set.bio(
|
58
|
+
it 'has the correct output' do
|
59
|
+
@set.bio('Vagabond.')
|
60
60
|
expect($stdout.string.chomp).to eq "@testcli's bio has been updated."
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
describe
|
64
|
+
describe '#language' do
|
65
65
|
before do
|
66
|
-
@set.options = @set.options.merge(
|
67
|
-
stub_post(
|
66
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
67
|
+
stub_post('/1.1/account/settings.json').with(:body => {:lang => 'en'}).to_return(:body => fixture('settings.json'))
|
68
68
|
end
|
69
|
-
it
|
70
|
-
@set.language(
|
71
|
-
expect(a_post(
|
69
|
+
it 'requests the correct resource' do
|
70
|
+
@set.language('en')
|
71
|
+
expect(a_post('/1.1/account/settings.json').with(:body => {:lang => 'en'})).to have_been_made
|
72
72
|
end
|
73
|
-
it
|
74
|
-
@set.language(
|
73
|
+
it 'has the correct output' do
|
74
|
+
@set.language('en')
|
75
75
|
expect($stdout.string.chomp).to eq "@testcli's language has been updated."
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
|
-
describe
|
79
|
+
describe '#location' do
|
80
80
|
before do
|
81
|
-
@set.options = @set.options.merge(
|
82
|
-
stub_post(
|
81
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
82
|
+
stub_post('/1.1/account/update_profile.json').with(:body => {:location => 'San Francisco'}).to_return(:body => fixture('sferik.json'))
|
83
83
|
end
|
84
|
-
it
|
85
|
-
@set.location(
|
86
|
-
expect(a_post(
|
84
|
+
it 'requests the correct resource' do
|
85
|
+
@set.location('San Francisco')
|
86
|
+
expect(a_post('/1.1/account/update_profile.json').with(:body => {:location => 'San Francisco'})).to have_been_made
|
87
87
|
end
|
88
|
-
it
|
89
|
-
@set.location(
|
88
|
+
it 'has the correct output' do
|
89
|
+
@set.location('San Francisco')
|
90
90
|
expect($stdout.string.chomp).to eq "@testcli's location has been updated."
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
describe
|
94
|
+
describe '#name' do
|
95
95
|
before do
|
96
|
-
@set.options = @set.options.merge(
|
97
|
-
stub_post(
|
96
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
97
|
+
stub_post('/1.1/account/update_profile.json').with(:body => {:name => 'Erik Michaels-Ober'}).to_return(:body => fixture('sferik.json'))
|
98
98
|
end
|
99
|
-
it
|
100
|
-
@set.name(
|
101
|
-
expect(a_post(
|
99
|
+
it 'requests the correct resource' do
|
100
|
+
@set.name('Erik Michaels-Ober')
|
101
|
+
expect(a_post('/1.1/account/update_profile.json').with(:body => {:name => 'Erik Michaels-Ober'})).to have_been_made
|
102
102
|
end
|
103
|
-
it
|
104
|
-
@set.name(
|
103
|
+
it 'has the correct output' do
|
104
|
+
@set.name('Erik Michaels-Ober')
|
105
105
|
expect($stdout.string.chomp).to eq "@testcli's name has been updated."
|
106
106
|
end
|
107
107
|
end
|
108
108
|
|
109
|
-
describe
|
109
|
+
describe '#profile_background_image' do
|
110
110
|
before do
|
111
|
-
@set.options = @set.options.merge(
|
112
|
-
stub_post(
|
111
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
112
|
+
stub_post('/1.1/account/update_profile_background_image.json').to_return(:body => fixture('sferik.json'))
|
113
113
|
end
|
114
|
-
it
|
115
|
-
@set.profile_background_image(fixture_path +
|
116
|
-
expect(a_post(
|
114
|
+
it 'requests the correct resource' do
|
115
|
+
@set.profile_background_image(fixture_path + '/we_concept_bg2.png')
|
116
|
+
expect(a_post('/1.1/account/update_profile_background_image.json')).to have_been_made
|
117
117
|
end
|
118
|
-
it
|
119
|
-
@set.profile_background_image(fixture_path +
|
118
|
+
it 'has the correct output' do
|
119
|
+
@set.profile_background_image(fixture_path + '/we_concept_bg2.png')
|
120
120
|
expect($stdout.string.chomp).to eq "@testcli's background image has been updated."
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
describe
|
124
|
+
describe '#profile_image' do
|
125
125
|
before do
|
126
|
-
@set.options = @set.options.merge(
|
127
|
-
stub_post(
|
126
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
127
|
+
stub_post('/1.1/account/update_profile_image.json').to_return(:body => fixture('sferik.json'))
|
128
128
|
end
|
129
|
-
it
|
130
|
-
@set.profile_image(fixture_path +
|
131
|
-
expect(a_post(
|
129
|
+
it 'requests the correct resource' do
|
130
|
+
@set.profile_image(fixture_path + '/me.jpg')
|
131
|
+
expect(a_post('/1.1/account/update_profile_image.json')).to have_been_made
|
132
132
|
end
|
133
|
-
it
|
134
|
-
@set.profile_image(fixture_path +
|
133
|
+
it 'has the correct output' do
|
134
|
+
@set.profile_image(fixture_path + '/me.jpg')
|
135
135
|
expect($stdout.string.chomp).to eq "@testcli's image has been updated."
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
139
|
-
describe
|
139
|
+
describe '#website' do
|
140
140
|
before do
|
141
|
-
@set.options = @set.options.merge(
|
142
|
-
stub_post(
|
141
|
+
@set.options = @set.options.merge('profile' => fixture_path + '/.trc')
|
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
|
-
it
|
145
|
-
@set.website(
|
146
|
-
expect(a_post(
|
144
|
+
it 'requests the correct resource' do
|
145
|
+
@set.website('https://github.com/sferik')
|
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
|
-
it
|
149
|
-
@set.website(
|
148
|
+
it 'has the correct output' do
|
149
|
+
@set.website('https://github.com/sferik')
|
150
150
|
expect($stdout.string.chomp).to eq "@testcli's website has been updated."
|
151
151
|
end
|
152
152
|
end
|
data/spec/stream_spec.rb
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
describe T::Stream do
|
4
|
-
let(:t_class)
|
4
|
+
let(:t_class) do
|
5
5
|
klass = Class.new
|
6
6
|
allow(klass).to receive(:options=).and_return
|
7
7
|
allow(klass).to receive(:options).and_return({})
|
8
8
|
klass
|
9
|
-
|
9
|
+
end
|
10
10
|
|
11
11
|
before :all do
|
12
|
-
@status = status_from_fixture(
|
12
|
+
@status = status_from_fixture('status.json')
|
13
13
|
end
|
14
14
|
|
15
15
|
before :each do
|
16
|
-
T::RCFile.instance.path = fixture_path +
|
16
|
+
T::RCFile.instance.path = fixture_path + '/.trc'
|
17
17
|
@client = double('Twitter::Streaming::Client').as_null_object
|
18
18
|
@stream = T::Stream.new
|
19
19
|
allow(@stream).to receive(:client) { @client }
|
@@ -21,18 +21,18 @@ describe T::Stream do
|
|
21
21
|
allow(STDOUT).to receive(:tty?).and_return(true)
|
22
22
|
end
|
23
23
|
|
24
|
-
|
25
|
-
context
|
24
|
+
describe '#all' do
|
25
|
+
context '--csv' do
|
26
26
|
before :each do
|
27
|
-
@stream.options = @stream.options.merge(
|
27
|
+
@stream.options = @stream.options.merge('csv' => true)
|
28
28
|
end
|
29
|
-
it
|
29
|
+
it 'outputs headings when the stream initializes' do
|
30
30
|
allow(@client).to receive(:sample).and_return
|
31
31
|
allow(@client).to receive(:before_request).and_yield
|
32
32
|
expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
|
33
33
|
@stream.all
|
34
34
|
end
|
35
|
-
it
|
35
|
+
it 'outputs in CSV format' do
|
36
36
|
allow(@client).to receive(:before_request).and_return
|
37
37
|
allow(@client).to receive(:sample).
|
38
38
|
and_yield(@status)
|
@@ -41,19 +41,19 @@ describe T::Stream do
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
context
|
44
|
+
context '--long' do
|
45
45
|
before :each do
|
46
|
-
@stream.options = @stream.options.merge(
|
46
|
+
@stream.options = @stream.options.merge('long' => true)
|
47
47
|
end
|
48
48
|
|
49
|
-
it
|
49
|
+
it 'outputs headings when the stream initializes' do
|
50
50
|
allow(@client).to receive(:before_request).and_yield
|
51
51
|
allow(@client).to receive(:sample).and_return
|
52
52
|
expect(@stream).to receive(:print_table).with(any_args)
|
53
53
|
@stream.all
|
54
54
|
end
|
55
55
|
|
56
|
-
it
|
56
|
+
it 'outputs in long text format' do
|
57
57
|
allow(@client).to receive(:before_request).and_return
|
58
58
|
allow(@client).to receive(:sample).
|
59
59
|
and_yield(@status)
|
@@ -62,85 +62,85 @@ describe T::Stream do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
context
|
65
|
+
context 'normal usage' do
|
66
66
|
before :each do
|
67
67
|
allow(@client).to receive(:sample).
|
68
68
|
and_yield(@status)
|
69
69
|
end
|
70
70
|
|
71
|
-
it
|
71
|
+
it 'prints the tweet status' do
|
72
72
|
expect(@stream).to receive(:print_message)
|
73
73
|
@stream.all
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
-
it
|
77
|
+
it 'invokes Twitter::Streaming::Client#sample' do
|
78
78
|
expect(@client).to receive(:sample)
|
79
79
|
@stream.all
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe
|
83
|
+
describe '#matrix' do
|
84
84
|
before :each do
|
85
85
|
allow(@client).to receive(:sample).
|
86
86
|
and_yield(@status)
|
87
87
|
end
|
88
88
|
|
89
|
-
it
|
89
|
+
it 'outputs the tweet status' do
|
90
90
|
expect(@stream).to receive(:say).with(any_args)
|
91
91
|
@stream.matrix
|
92
92
|
end
|
93
93
|
|
94
|
-
it
|
94
|
+
it 'invokes Twitter::Streaming::Client.sample' do
|
95
95
|
expect(@client).to receive(:sample)
|
96
96
|
@stream.matrix
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
-
describe
|
100
|
+
describe '#search' do
|
101
101
|
before :each do
|
102
|
-
allow(@client).to receive(:filter).with(:track => [
|
102
|
+
allow(@client).to receive(:filter).with(:track => ['gem']).
|
103
103
|
and_yield(@status)
|
104
104
|
end
|
105
105
|
|
106
|
-
context
|
106
|
+
context '--csv' do
|
107
107
|
before :each do
|
108
|
-
@stream.options = @stream.options.merge(
|
108
|
+
@stream.options = @stream.options.merge('csv' => true)
|
109
109
|
end
|
110
110
|
|
111
|
-
it
|
111
|
+
it 'outputs in CSV format' do
|
112
112
|
allow(@client).to receive(:before_request).and_return
|
113
113
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
114
114
|
@stream.search('gem')
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
|
-
context
|
118
|
+
context '--long' do
|
119
119
|
before :each do
|
120
|
-
@stream.options = @stream.options.merge(
|
120
|
+
@stream.options = @stream.options.merge('long' => true)
|
121
121
|
end
|
122
122
|
|
123
|
-
it
|
123
|
+
it 'outputs in long text format' do
|
124
124
|
allow(@client).to receive(:before_request).and_return
|
125
|
-
allow(@client).to receive(:filter).with(:track => [
|
125
|
+
allow(@client).to receive(:filter).with(:track => ['gem']).
|
126
126
|
and_yield(@status)
|
127
127
|
expect(@stream).to receive(:print_table).with(any_args)
|
128
128
|
@stream.search('gem')
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
context
|
132
|
+
context 'normal usage' do
|
133
133
|
before :each do
|
134
|
-
allow(@client).to receive(:filter).with(:track => [
|
134
|
+
allow(@client).to receive(:filter).with(:track => ['gem']).
|
135
135
|
and_yield(@status)
|
136
136
|
end
|
137
|
-
it
|
137
|
+
it 'prints the tweet status' do
|
138
138
|
expect(@stream).to receive(:print_message)
|
139
139
|
@stream.search('gem')
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
-
it
|
143
|
+
it 'performs a REST search when the stream initializes' do
|
144
144
|
allow(@client).to receive(:filter).and_return
|
145
145
|
allow(@client).to receive(:before_request).and_yield
|
146
146
|
allow(T::Search).to receive(:new).and_return(t_class)
|
@@ -148,37 +148,37 @@ describe T::Stream do
|
|
148
148
|
@stream.search('t', 'gem')
|
149
149
|
end
|
150
150
|
|
151
|
-
it
|
151
|
+
it 'invokes Twitter::Streaming::Client#filter' do
|
152
152
|
allow(@client).to receive(:filter).and_return
|
153
153
|
expect(@client).to receive(:filter).with(:track => ['gem'])
|
154
154
|
@stream.search('gem')
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
describe
|
158
|
+
describe '#timeline' do
|
159
159
|
before :each do
|
160
160
|
allow(@client).to receive(:user).
|
161
161
|
and_yield(@status)
|
162
162
|
end
|
163
163
|
|
164
|
-
context
|
164
|
+
context '--csv' do
|
165
165
|
before :each do
|
166
|
-
@stream.options = @stream.options.merge(
|
166
|
+
@stream.options = @stream.options.merge('csv' => true)
|
167
167
|
end
|
168
168
|
|
169
|
-
it
|
169
|
+
it 'outputs in CSV format' do
|
170
170
|
allow(@client).to receive(:before_request).and_return
|
171
171
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
172
172
|
@stream.timeline
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
176
|
-
context
|
176
|
+
context '--long' do
|
177
177
|
before :each do
|
178
|
-
@stream.options = @stream.options.merge(
|
178
|
+
@stream.options = @stream.options.merge('long' => true)
|
179
179
|
end
|
180
180
|
|
181
|
-
it
|
181
|
+
it 'outputs in long text format' do
|
182
182
|
allow(@client).to receive(:before_request).and_return
|
183
183
|
allow(@client).to receive(:user).
|
184
184
|
and_yield(@status)
|
@@ -187,19 +187,19 @@ describe T::Stream do
|
|
187
187
|
end
|
188
188
|
end
|
189
189
|
|
190
|
-
context
|
190
|
+
context 'normal usage' do
|
191
191
|
before :each do
|
192
192
|
allow(@client).to receive(:user).
|
193
193
|
and_yield(@status)
|
194
194
|
end
|
195
195
|
|
196
|
-
it
|
196
|
+
it 'prints the tweet status' do
|
197
197
|
expect(@stream).to receive(:print_message)
|
198
198
|
@stream.timeline
|
199
199
|
end
|
200
200
|
end
|
201
201
|
|
202
|
-
it
|
202
|
+
it 'performs a REST search when the stream initializes' do
|
203
203
|
allow(@client).to receive(:user).and_return
|
204
204
|
allow(@client).to receive(:before_request).and_yield
|
205
205
|
allow(T::CLI).to receive(:new).and_return(t_class)
|
@@ -208,51 +208,51 @@ describe T::Stream do
|
|
208
208
|
@stream.timeline
|
209
209
|
end
|
210
210
|
|
211
|
-
it
|
211
|
+
it 'invokes Twitter::Streaming::Client#userstream' do
|
212
212
|
allow(@client).to receive(:user).and_return
|
213
213
|
expect(@client).to receive(:user)
|
214
214
|
@stream.timeline
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
-
describe
|
218
|
+
describe '#users' do
|
219
219
|
before :each do
|
220
220
|
allow(@client).to receive(:follow).
|
221
221
|
and_yield(@status)
|
222
222
|
end
|
223
223
|
|
224
|
-
context
|
224
|
+
context '--csv' do
|
225
225
|
before :each do
|
226
|
-
@stream.options = @stream.options.merge(
|
226
|
+
@stream.options = @stream.options.merge('csv' => true)
|
227
227
|
end
|
228
228
|
|
229
|
-
it
|
229
|
+
it 'outputs headings when the stream initializes' do
|
230
230
|
allow(@client).to receive(:follow).and_return
|
231
231
|
allow(@client).to receive(:before_request).and_yield
|
232
232
|
expect(@stream).to receive(:say).with("ID,Posted at,Screen name,Text\n")
|
233
233
|
@stream.users('123')
|
234
234
|
end
|
235
235
|
|
236
|
-
it
|
236
|
+
it 'outputs in CSV format' do
|
237
237
|
allow(@client).to receive(:before_request).and_return
|
238
238
|
expect(@stream).to receive(:print_csv_tweet).with(any_args)
|
239
239
|
@stream.users('123')
|
240
240
|
end
|
241
241
|
end
|
242
242
|
|
243
|
-
context
|
243
|
+
context '--long' do
|
244
244
|
before :each do
|
245
|
-
@stream.options = @stream.options.merge(
|
245
|
+
@stream.options = @stream.options.merge('long' => true)
|
246
246
|
end
|
247
247
|
|
248
|
-
it
|
248
|
+
it 'outputs headings when the stream initializes' do
|
249
249
|
allow(@client).to receive(:before_request).and_yield
|
250
250
|
allow(@client).to receive(:follow).and_return
|
251
251
|
expect(@stream).to receive(:print_table).with(any_args)
|
252
252
|
@stream.users('123')
|
253
253
|
end
|
254
254
|
|
255
|
-
it
|
255
|
+
it 'outputs in long text format' do
|
256
256
|
allow(@client).to receive(:before_request).and_return
|
257
257
|
allow(@client).to receive(:follow).
|
258
258
|
and_yield(@status)
|
@@ -261,19 +261,19 @@ describe T::Stream do
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
|
-
context
|
264
|
+
context 'normal usage' do
|
265
265
|
before :each do
|
266
266
|
allow(@client).to receive(:follow).
|
267
267
|
and_yield(@status)
|
268
268
|
end
|
269
269
|
|
270
|
-
it
|
270
|
+
it 'prints the tweet status' do
|
271
271
|
expect(@stream).to receive(:print_message)
|
272
272
|
@stream.users('123')
|
273
273
|
end
|
274
274
|
end
|
275
275
|
|
276
|
-
it
|
276
|
+
it 'invokes Twitter::Streaming::Client#follow' do
|
277
277
|
allow(@client).to receive(:follow).and_return
|
278
278
|
expect(@client).to receive(:follow).with([123, 456, 789])
|
279
279
|
@stream.users('123', '456', '789')
|