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/spec/rcfile_spec.rb CHANGED
@@ -5,28 +5,28 @@ describe T::RCFile do
5
5
 
6
6
  after :each do
7
7
  T::RCFile.instance.reset
8
- File.delete(project_path + "/tmp/trc") if File.exist?(project_path + "/tmp/trc")
8
+ File.delete(project_path + '/tmp/trc') if File.exist?(project_path + '/tmp/trc')
9
9
  end
10
10
 
11
- it "is a singleton" do
11
+ it 'is a singleton' do
12
12
  expect(T::RCFile).to be_a Class
13
13
  expect do
14
14
  T::RCFile.new
15
15
  end.to raise_error(NoMethodError, /private method `new' called/)
16
16
  end
17
17
 
18
- describe "#[]" do
19
- it "returns the profiles for a user" do
18
+ describe '#[]' do
19
+ it 'returns the profiles for a user' do
20
20
  rcfile = T::RCFile.instance
21
- rcfile.path = fixture_path + "/.trc"
22
- expect(rcfile['testcli'].keys).to eq ['abc123']
21
+ rcfile.path = fixture_path + '/.trc'
22
+ expect(rcfile['testcli'].keys).to eq %w[abc123]
23
23
  end
24
24
  end
25
25
 
26
- describe "#[]=" do
27
- it "adds a profile for a user" do
26
+ describe '#[]=' do
27
+ it 'adds a profile for a user' do
28
28
  rcfile = T::RCFile.instance
29
- rcfile.path = project_path + "/tmp/trc"
29
+ rcfile.path = project_path + '/tmp/trc'
30
30
  rcfile['testcli'] = {
31
31
  'abc123' => {
32
32
  :username => 'testcli',
@@ -36,11 +36,11 @@ describe T::RCFile do
36
36
  :secret => 'jkl012',
37
37
  }
38
38
  }
39
- expect(rcfile['testcli'].keys).to eq ['abc123']
39
+ expect(rcfile['testcli'].keys).to eq %w[abc123]
40
40
  end
41
- it "writes the data to a file" do
41
+ it 'writes the data to a file' do
42
42
  rcfile = T::RCFile.instance
43
- rcfile.path = project_path + "/tmp/trc"
43
+ rcfile.path = project_path + '/tmp/trc'
44
44
  rcfile['testcli'] = {
45
45
  'abc123' => {
46
46
  :username => 'testcli',
@@ -50,11 +50,11 @@ describe T::RCFile do
50
50
  :secret => 'jkl012',
51
51
  }
52
52
  }
53
- expect(rcfile['testcli'].keys).to eq ['abc123']
53
+ expect(rcfile['testcli'].keys).to eq %w[abc123]
54
54
  end
55
- it "is not be world writable" do
55
+ it 'is not be world writable' do
56
56
  rcfile = T::RCFile.instance
57
- rcfile.path = project_path + "/tmp/trc"
57
+ rcfile.path = project_path + '/tmp/trc'
58
58
  rcfile['testcli'] = {
59
59
  'abc123' => {
60
60
  :username => 'testcli',
@@ -66,9 +66,9 @@ describe T::RCFile do
66
66
  }
67
67
  expect(File.world_writable?(rcfile.path)).to be nil
68
68
  end
69
- it "is not be world readable" do
69
+ it 'is not be world readable' do
70
70
  rcfile = T::RCFile.instance
71
- rcfile.path = project_path + "/tmp/trc"
71
+ rcfile.path = project_path + '/tmp/trc'
72
72
  rcfile['testcli'] = {
73
73
  'abc123' => {
74
74
  :username => 'testcli',
@@ -82,73 +82,73 @@ describe T::RCFile do
82
82
  end
83
83
  end
84
84
 
85
- describe "#configuration" do
86
- it "returns configuration" do
85
+ describe '#configuration' do
86
+ it 'returns configuration' do
87
87
  rcfile = T::RCFile.instance
88
- rcfile.path = fixture_path + "/.trc"
89
- expect(rcfile.configuration.keys).to eq ['default_profile']
88
+ rcfile.path = fixture_path + '/.trc'
89
+ expect(rcfile.configuration.keys).to eq %w[default_profile]
90
90
  end
91
91
  end
92
92
 
93
- describe "#active_consumer_key" do
94
- it "returns default consumer key" do
93
+ describe '#active_consumer_key' do
94
+ it 'returns default consumer key' do
95
95
  rcfile = T::RCFile.instance
96
- rcfile.path = fixture_path + "/.trc"
96
+ rcfile.path = fixture_path + '/.trc'
97
97
  expect(rcfile.active_consumer_key).to eq 'abc123'
98
98
  end
99
99
  end
100
100
 
101
- describe "#active_consumer_secret" do
102
- it "returns default consumer secret" do
101
+ describe '#active_consumer_secret' do
102
+ it 'returns default consumer secret' do
103
103
  rcfile = T::RCFile.instance
104
- rcfile.path = fixture_path + "/.trc"
104
+ rcfile.path = fixture_path + '/.trc'
105
105
  expect(rcfile.active_consumer_secret).to eq 'asdfasd223sd2'
106
106
  end
107
107
  end
108
108
 
109
- describe "#active_profile" do
110
- it "returns default profile" do
109
+ describe '#active_profile' do
110
+ it 'returns default profile' do
111
111
  rcfile = T::RCFile.instance
112
- rcfile.path = fixture_path + "/.trc"
113
- expect(rcfile.active_profile).to eq ['testcli', 'abc123']
112
+ rcfile.path = fixture_path + '/.trc'
113
+ expect(rcfile.active_profile).to eq %w[testcli abc123]
114
114
  end
115
115
  end
116
116
 
117
- describe "#active_profile=" do
118
- it "sets default profile" do
117
+ describe '#active_profile=' do
118
+ it 'sets default profile' do
119
119
  rcfile = T::RCFile.instance
120
- rcfile.path = project_path + "/tmp/trc"
120
+ rcfile.path = project_path + '/tmp/trc'
121
121
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
122
- expect(rcfile.active_profile).to eq ['testcli', 'abc123']
122
+ expect(rcfile.active_profile).to eq %w[testcli abc123]
123
123
  end
124
- it "writes the data to a file" do
124
+ it 'writes the data to a file' do
125
125
  rcfile = T::RCFile.instance
126
- rcfile.path = project_path + "/tmp/trc"
126
+ rcfile.path = project_path + '/tmp/trc'
127
127
  rcfile.active_profile = {'username' => 'testcli', 'consumer_key' => 'abc123'}
128
- expect(rcfile.active_profile).to eq ['testcli', 'abc123']
128
+ expect(rcfile.active_profile).to eq %w[testcli abc123]
129
129
  end
130
130
  end
131
131
 
132
- describe "#active_token" do
133
- it "returns default token" do
132
+ describe '#active_token' do
133
+ it 'returns default token' do
134
134
  rcfile = T::RCFile.instance
135
- rcfile.path = fixture_path + "/.trc"
135
+ rcfile.path = fixture_path + '/.trc'
136
136
  expect(rcfile.active_token).to eq '428004849-cebdct6bwobn'
137
137
  end
138
138
  end
139
139
 
140
- describe "#active_secret" do
141
- it "returns default secret" do
140
+ describe '#active_secret' do
141
+ it 'returns default secret' do
142
142
  rcfile = T::RCFile.instance
143
- rcfile.path = fixture_path + "/.trc"
143
+ rcfile.path = fixture_path + '/.trc'
144
144
  expect(rcfile.active_secret).to eq 'epzrjvxtumoc'
145
145
  end
146
146
  end
147
147
 
148
- describe "#delete" do
149
- it "deletes the rcfile" do
150
- path = project_path + "/tmp/trc"
151
- File.open(path, 'w'){|file| file.write(YAML.dump({}))}
148
+ describe '#delete' do
149
+ it 'deletes the rcfile' do
150
+ path = project_path + '/tmp/trc'
151
+ File.open(path, 'w') { |file| file.write(YAML.dump({})) }
152
152
  expect(File.exist?(path)).to be true
153
153
  rcfile = T::RCFile.instance
154
154
  rcfile.path = path
@@ -157,16 +157,16 @@ describe T::RCFile do
157
157
  end
158
158
  end
159
159
 
160
- describe "#empty?" do
161
- context "when a non-empty file exists" do
162
- it "returns false" do
160
+ describe '#empty?' do
161
+ context 'when a non-empty file exists' do
162
+ it 'returns false' do
163
163
  rcfile = T::RCFile.instance
164
- rcfile.path = fixture_path + "/.trc"
164
+ rcfile.path = fixture_path + '/.trc'
165
165
  expect(rcfile.empty?).to be false
166
166
  end
167
167
  end
168
- context "when file does not exist at path" do
169
- it "returns true" do
168
+ context 'when file does not exist at path' do
169
+ it 'returns true' do
170
170
  rcfile = T::RCFile.instance
171
171
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
172
172
  expect(rcfile.empty?).to be true
@@ -174,47 +174,47 @@ describe T::RCFile do
174
174
  end
175
175
  end
176
176
 
177
- describe "#load_file" do
178
- context "when file exists at path" do
179
- it "loads data from file" do
177
+ describe '#load_file' do
178
+ context 'when file exists at path' do
179
+ it 'loads data from file' do
180
180
  rcfile = T::RCFile.instance
181
- rcfile.path = fixture_path + "/.trc"
181
+ rcfile.path = fixture_path + '/.trc'
182
182
  expect(rcfile.load_file['profiles']['testcli']['abc123']['username']).to eq 'testcli'
183
183
  end
184
184
  end
185
- context "when file does not exist at path" do
186
- it "loads default structure" do
185
+ context 'when file does not exist at path' do
186
+ it 'loads default structure' do
187
187
  rcfile = T::RCFile.instance
188
188
  rcfile.path = File.expand_path('../fixtures/foo', __FILE__)
189
- expect(rcfile.load_file.keys.sort).to eq ['configuration', 'profiles']
189
+ expect(rcfile.load_file.keys.sort).to eq %w[configuration profiles]
190
190
  end
191
191
  end
192
192
  end
193
193
 
194
- describe "#path" do
195
- it "defaults to ~/.trc" do
194
+ describe '#path' do
195
+ it 'defaults to ~/.trc' do
196
196
  expect(T::RCFile.instance.path).to eq File.join(File.expand_path('~'), '.trc')
197
197
  end
198
198
  end
199
199
 
200
- describe "#path=" do
201
- it "overrides path" do
200
+ describe '#path=' do
201
+ it 'overrides path' do
202
202
  rcfile = T::RCFile.instance
203
- rcfile.path = project_path + "/tmp/trc"
204
- expect(rcfile.path).to eq project_path + "/tmp/trc"
203
+ rcfile.path = project_path + '/tmp/trc'
204
+ expect(rcfile.path).to eq project_path + '/tmp/trc'
205
205
  end
206
- it "reloads data" do
206
+ it 'reloads data' do
207
207
  rcfile = T::RCFile.instance
208
- rcfile.path = fixture_path + "/.trc"
208
+ rcfile.path = fixture_path + '/.trc'
209
209
  expect(rcfile['testcli']['abc123']['username']).to eq 'testcli'
210
210
  end
211
211
  end
212
212
 
213
- describe "#profiles" do
214
- it "returns profiles" do
213
+ describe '#profiles' do
214
+ it 'returns profiles' do
215
215
  rcfile = T::RCFile.instance
216
- rcfile.path = fixture_path + "/.trc"
217
- expect(rcfile.profiles.keys).to eq ['testcli']
216
+ rcfile.path = fixture_path + '/.trc'
217
+ expect(rcfile.profiles.keys).to eq %w[testcli]
218
218
  end
219
219
  end
220
220
 
data/spec/search_spec.rb CHANGED
@@ -14,9 +14,9 @@ describe T::Search do
14
14
  end
15
15
 
16
16
  before :each do
17
- T::RCFile.instance.path = fixture_path + "/.trc"
17
+ T::RCFile.instance.path = fixture_path + '/.trc'
18
18
  @search = T::Search.new
19
- @search.options = @search.options.merge("color" => "always")
19
+ @search.options = @search.options.merge('color' => 'always')
20
20
  @old_stderr = $stderr
21
21
  $stderr = StringIO.new
22
22
  @old_stdout = $stdout
@@ -29,16 +29,16 @@ describe T::Search do
29
29
  $stdout = @old_stdout
30
30
  end
31
31
 
32
- describe "#all" do
32
+ describe '#all' do
33
33
  before do
34
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "20"}).to_return(:body => fixture("search.json"))
34
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '20'}).to_return(:body => fixture('search.json'))
35
35
  end
36
- it "requests the correct resource" do
37
- @search.all("twitter")
38
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "20"})).to have_been_made
36
+ it 'requests the correct resource' do
37
+ @search.all('twitter')
38
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '20'})).to have_been_made
39
39
  end
40
- it "has the correct output" do
41
- @search.all("twitter")
40
+ it 'has the correct output' do
41
+ @search.all('twitter')
42
42
  expect($stdout.string).to eq <<-eos
43
43
 
44
44
  @saintsday998
@@ -427,12 +427,12 @@ describe T::Search do
427
427
 
428
428
  eos
429
429
  end
430
- context "--csv" do
430
+ context '--csv' do
431
431
  before do
432
- @search.options = @search.options.merge("csv" => true)
432
+ @search.options = @search.options.merge('csv' => true)
433
433
  end
434
- it "outputs in CSV format" do
435
- @search.all("twitter")
434
+ it 'outputs in CSV format' do
435
+ @search.all('twitter')
436
436
  expect($stdout.string).to eq <<-eos
437
437
  ID,Posted at,Screen name,Text
438
438
  267024754278539266,2012-11-09 22:03:57 +0000,saintsday998,"Murray Energy Corp. Obama Reelection, Announces Layoffs http://t.co/D1OPtKnw via @HuffPostBiz MAYBE his workers can do something for him ?"
@@ -546,28 +546,28 @@ http://t.co/erdKx6HD"
546
546
  eos
547
547
  end
548
548
  end
549
- context "--decode-uris" do
549
+ context '--decode-uris' do
550
550
  before(:each) do
551
- @search.options = @search.options.merge("decode_uris" => true)
552
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :include_entities => 1, :count => 20}).to_return(:body => fixture("search_with_entities.json"))
553
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :include_entities => 1, :count => 5, :max_id => 264784855672442882}).to_return(:body => fixture("search_with_entities.json"))
551
+ @search.options = @search.options.merge('decode_uris' => true)
552
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :include_entities => 1, :count => 20}).to_return(:body => fixture('search_with_entities.json'))
553
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :include_entities => 1, :count => 5, :max_id => 264_784_855_672_442_882}).to_return(:body => fixture('search_with_entities.json'))
554
554
  end
555
- it "requests the correct resource" do
556
- @search.all("twitter")
557
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :include_entities => 1, :count => 20})).to have_been_made
558
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :include_entities => 1, :count => 5, :max_id => 264784855672442882})).to have_been_made
555
+ it 'requests the correct resource' do
556
+ @search.all('twitter')
557
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :include_entities => 1, :count => 20})).to have_been_made
558
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :include_entities => 1, :count => 5, :max_id => 264_784_855_672_442_882})).to have_been_made
559
559
  end
560
- it "decodes URLs" do
561
- @search.all("twitter")
562
- expect($stdout.string).to include "http://semver.org"
560
+ it 'decodes URLs' do
561
+ @search.all('twitter')
562
+ expect($stdout.string).to include 'http://semver.org'
563
563
  end
564
564
  end
565
- context "--long" do
565
+ context '--long' do
566
566
  before do
567
- @search.options = @search.options.merge("long" => true)
567
+ @search.options = @search.options.merge('long' => true)
568
568
  end
569
- it "outputs in long format" do
570
- @search.all("twitter")
569
+ it 'outputs in long format' do
570
+ @search.all('twitter')
571
571
  expect($stdout.string).to eq <<-eos
572
572
  ID Posted at Screen name Text
573
573
  267024754278539266 Nov 9 14:03 @saintsday998 Murray Energy Corp. Obama...
@@ -671,40 +671,40 @@ ID Posted at Screen name Text
671
671
  eos
672
672
  end
673
673
  end
674
- context "--number" do
674
+ context '--number' do
675
675
  before do
676
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "1"}).to_return(:body => fixture("search.json"))
677
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "200"}).to_return(:body => fixture("search.json"))
678
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "103", :max_id => "267024711169503231"}).to_return(:body => fixture("search.json"))
679
- stub_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "5", :max_id => "267024711169503231"}).to_return(:body => fixture("search.json"))
676
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '1'}).to_return(:body => fixture('search.json'))
677
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '200'}).to_return(:body => fixture('search.json'))
678
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '103', :max_id => '267024711169503231'}).to_return(:body => fixture('search.json'))
679
+ stub_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '5', :max_id => '267024711169503231'}).to_return(:body => fixture('search.json'))
680
680
  end
681
- it "limits the number of results to 1" do
682
- @search.options = @search.options.merge("number" => 1)
683
- results = @search.all("twitter")
684
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "1"})).to have_been_made
681
+ it 'limits the number of results to 1' do
682
+ @search.options = @search.options.merge('number' => 1)
683
+ @search.all('twitter')
684
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '1'})).to have_been_made
685
685
  end
686
- it "limits the number of results to 201" do
687
- @search.options = @search.options.merge("number" => 201)
688
- @search.all("twitter")
689
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "200"})).to have_been_made
690
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "103", :max_id => "267024711169503231"})).to have_been_made
691
- expect(a_get("/1.1/search/tweets.json").with(:query => {:q => "twitter", :count => "5", :max_id => "267024711169503231"})).to have_been_made
686
+ it 'limits the number of results to 201' do
687
+ @search.options = @search.options.merge('number' => 201)
688
+ @search.all('twitter')
689
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '200'})).to have_been_made
690
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '103', :max_id => '267024711169503231'})).to have_been_made
691
+ expect(a_get('/1.1/search/tweets.json').with(:query => {:q => 'twitter', :count => '5', :max_id => '267024711169503231'})).to have_been_made
692
692
  end
693
693
  end
694
694
  end
695
695
 
696
- describe "#favorites" do
696
+ describe '#favorites' do
697
697
  before do
698
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"))
699
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
698
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
699
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
700
700
  end
701
- it "requests the correct resource" do
702
- @search.favorites("twitter")
703
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made
704
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
701
+ it 'requests the correct resource' do
702
+ @search.favorites('twitter')
703
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200'})).to have_been_made
704
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
705
705
  end
706
- it "has the correct output" do
707
- @search.favorites("twitter")
706
+ it 'has the correct output' do
707
+ @search.favorites('twitter')
708
708
  expect($stdout.string).to eq <<-eos
709
709
  @sferik
710
710
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -715,12 +715,12 @@ ID Posted at Screen name Text
715
715
 
716
716
  eos
717
717
  end
718
- context "--csv" do
718
+ context '--csv' do
719
719
  before do
720
- @search.options = @search.options.merge("csv" => true)
720
+ @search.options = @search.options.merge('csv' => true)
721
721
  end
722
- it "outputs in CSV format" do
723
- @search.favorites("twitter")
722
+ it 'outputs in CSV format' do
723
+ @search.favorites('twitter')
724
724
  expect($stdout.string).to eq <<-eos
725
725
  ID,Posted at,Screen name,Text
726
726
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
@@ -728,28 +728,28 @@ ID,Posted at,Screen name,Text
728
728
  eos
729
729
  end
730
730
  end
731
- context "--decode-uris" do
731
+ context '--decode-uris' do
732
732
  before(:each) do
733
- @search.options = @search.options.merge("decode_uris" => true)
734
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :include_entities => 1}).to_return(:body => fixture("statuses.json"))
735
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
733
+ @search.options = @search.options.merge('decode_uris' => true)
734
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 1}).to_return(:body => fixture('statuses.json'))
735
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
736
736
  end
737
- it "requests the correct resource" do
738
- @search.favorites("twitter")
739
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :include_entities => 1})).to have_been_made
740
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937"})).to have_been_made
737
+ it 'requests the correct resource' do
738
+ @search.favorites('twitter')
739
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 1})).to have_been_made
740
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937'})).to have_been_made
741
741
  end
742
- it "decodes URLs" do
743
- @search.favorites("twitter")
744
- expect($stdout.string).to include "https://twitter.com/sferik/status/243988000076337152"
742
+ it 'decodes URLs' do
743
+ @search.favorites('twitter')
744
+ expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
745
745
  end
746
746
  end
747
- context "--long" do
747
+ context '--long' do
748
748
  before do
749
- @search.options = @search.options.merge("long" => true)
749
+ @search.options = @search.options.merge('long' => true)
750
750
  end
751
- it "outputs in long format" do
752
- @search.favorites("twitter")
751
+ it 'outputs in long format' do
752
+ @search.favorites('twitter')
753
753
  expect($stdout.string).to eq <<-eos
754
754
  ID Posted at Screen name Text
755
755
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
@@ -757,27 +757,27 @@ ID Posted at Screen name Text
757
757
  eos
758
758
  end
759
759
  end
760
- context "Twitter is down" do
761
- it "retries 3 times and then raise an error" do
762
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200"}).to_return(:status => 502)
760
+ context 'Twitter is down' do
761
+ it 'retries 3 times and then raise an error' do
762
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200'}).to_return(:status => 502)
763
763
  expect do
764
- @search.favorites("twitter")
764
+ @search.favorites('twitter')
765
765
  end.to raise_error(Twitter::Error::BadGateway)
766
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200"})).to have_been_made.times(3)
766
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200'})).to have_been_made.times(3)
767
767
  end
768
768
  end
769
- context "with a user passed" do
769
+ context 'with a user passed' do
770
770
  before do
771
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
772
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).to_return(:body => fixture("empty_array.json"))
771
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
772
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'}).to_return(:body => fixture('empty_array.json'))
773
773
  end
774
- it "requests the correct resource" do
775
- @search.favorites("sferik", "twitter")
776
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
777
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"})).to have_been_made
774
+ it 'requests the correct resource' do
775
+ @search.favorites('sferik', 'twitter')
776
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
777
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'})).to have_been_made
778
778
  end
779
- it "has the correct output" do
780
- @search.favorites("sferik", "twitter")
779
+ it 'has the correct output' do
780
+ @search.favorites('sferik', 'twitter')
781
781
  expect($stdout.string).to eq <<-eos
782
782
  @sferik
783
783
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -788,19 +788,19 @@ ID Posted at Screen name Text
788
788
 
789
789
  eos
790
790
  end
791
- context "--id" do
791
+ context '--id' do
792
792
  before do
793
- @search.options = @search.options.merge("id" => true)
794
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"))
795
- stub_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).to_return(:body => fixture("empty_array.json"))
793
+ @search.options = @search.options.merge('id' => true)
794
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
795
+ stub_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'}).to_return(:body => fixture('empty_array.json'))
796
796
  end
797
- it "requests the correct resource" do
798
- @search.favorites("7505382", "twitter")
799
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :user_id => "7505382"})).to have_been_made
800
- expect(a_get("/1.1/favorites/list.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"})).to have_been_made
797
+ it 'requests the correct resource' do
798
+ @search.favorites('7505382', 'twitter')
799
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :user_id => '7505382'})).to have_been_made
800
+ expect(a_get('/1.1/favorites/list.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'})).to have_been_made
801
801
  end
802
- it "has the correct output" do
803
- @search.favorites("7505382", "twitter")
802
+ it 'has the correct output' do
803
+ @search.favorites('7505382', 'twitter')
804
804
  expect($stdout.string).to eq <<-eos
805
805
  @sferik
806
806
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -815,18 +815,18 @@ ID Posted at Screen name Text
815
815
  end
816
816
  end
817
817
 
818
- describe "#mentions" do
818
+ describe '#mentions' do
819
819
  before do
820
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"))
821
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
820
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
821
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
822
822
  end
823
- it "requests the correct resource" do
824
- @search.mentions("twitter")
825
- expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made
826
- expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
823
+ it 'requests the correct resource' do
824
+ @search.mentions('twitter')
825
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'})).to have_been_made
826
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
827
827
  end
828
- it "has the correct output" do
829
- @search.mentions("twitter")
828
+ it 'has the correct output' do
829
+ @search.mentions('twitter')
830
830
  expect($stdout.string).to eq <<-eos
831
831
  @sferik
832
832
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -837,12 +837,12 @@ ID Posted at Screen name Text
837
837
 
838
838
  eos
839
839
  end
840
- context "--csv" do
840
+ context '--csv' do
841
841
  before do
842
- @search.options = @search.options.merge("csv" => true)
842
+ @search.options = @search.options.merge('csv' => true)
843
843
  end
844
- it "outputs in CSV format" do
845
- @search.mentions("twitter")
844
+ it 'outputs in CSV format' do
845
+ @search.mentions('twitter')
846
846
  expect($stdout.string).to eq <<-eos
847
847
  ID,Posted at,Screen name,Text
848
848
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
@@ -850,28 +850,28 @@ ID,Posted at,Screen name,Text
850
850
  eos
851
851
  end
852
852
  end
853
- context "--decode-uris" do
853
+ context '--decode-uris' do
854
854
  before(:each) do
855
- @search.options = @search.options.merge("decode_uris" => true)
856
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :include_entities => 1}).to_return(:body => fixture("statuses.json"))
857
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
855
+ @search.options = @search.options.merge('decode_uris' => true)
856
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 1}).to_return(:body => fixture('statuses.json'))
857
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
858
858
  end
859
- it "requests the correct resource" do
860
- @search.mentions("twitter")
861
- expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :include_entities => 1})).to have_been_made
862
- expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937"})).to have_been_made
859
+ it 'requests the correct resource' do
860
+ @search.mentions('twitter')
861
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 1})).to have_been_made
862
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937'})).to have_been_made
863
863
  end
864
- it "decodes URLs" do
865
- @search.mentions("twitter")
866
- expect($stdout.string).to include "https://twitter.com/sferik/status/243988000076337152"
864
+ it 'decodes URLs' do
865
+ @search.mentions('twitter')
866
+ expect($stdout.string).to include 'https://twitter.com/sferik/status/243988000076337152'
867
867
  end
868
868
  end
869
- context "--long" do
869
+ context '--long' do
870
870
  before do
871
- @search.options = @search.options.merge("long" => true)
871
+ @search.options = @search.options.merge('long' => true)
872
872
  end
873
- it "outputs in long format" do
874
- @search.mentions("twitter")
873
+ it 'outputs in long format' do
874
+ @search.mentions('twitter')
875
875
  expect($stdout.string).to eq <<-eos
876
876
  ID Posted at Screen name Text
877
877
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
@@ -879,29 +879,29 @@ ID Posted at Screen name Text
879
879
  eos
880
880
  end
881
881
  end
882
- context "Twitter is down" do
883
- it "retries 3 times and then raise an error" do
884
- stub_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"}).to_return(:status => 502)
882
+ context 'Twitter is down' do
883
+ it 'retries 3 times and then raise an error' do
884
+ stub_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'}).to_return(:status => 502)
885
885
  expect do
886
- @search.mentions("twitter")
886
+ @search.mentions('twitter')
887
887
  end.to raise_error(Twitter::Error::BadGateway)
888
- expect(a_get("/1.1/statuses/mentions_timeline.json").with(:query => {:count => "200"})).to have_been_made.times(3)
888
+ expect(a_get('/1.1/statuses/mentions_timeline.json').with(:query => {:count => '200'})).to have_been_made.times(3)
889
889
  end
890
890
  end
891
891
  end
892
892
 
893
- describe "#list" do
893
+ describe '#list' do
894
894
  before do
895
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("statuses.json"))
896
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("empty_array.json"))
895
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
896
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('empty_array.json'))
897
897
  end
898
- it "requests the correct resource" do
899
- @search.list("presidents", "twitter")
900
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
901
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
898
+ it 'requests the correct resource' do
899
+ @search.list('presidents', 'twitter')
900
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
901
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
902
902
  end
903
- it "has the correct output" do
904
- @search.list("presidents", "twitter")
903
+ it 'has the correct output' do
904
+ @search.list('presidents', 'twitter')
905
905
  expect($stdout.string).to eq <<-eos
906
906
  @sferik
907
907
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -912,12 +912,12 @@ ID Posted at Screen name Text
912
912
 
913
913
  eos
914
914
  end
915
- context "--csv" do
915
+ context '--csv' do
916
916
  before do
917
- @search.options = @search.options.merge("csv" => true)
917
+ @search.options = @search.options.merge('csv' => true)
918
918
  end
919
- it "outputs in CSV format" do
920
- @search.list("presidents", "twitter")
919
+ it 'outputs in CSV format' do
920
+ @search.list('presidents', 'twitter')
921
921
  expect($stdout.string).to eq <<-eos
922
922
  ID,Posted at,Screen name,Text
923
923
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
@@ -925,28 +925,28 @@ ID,Posted at,Screen name,Text
925
925
  eos
926
926
  end
927
927
  end
928
- context "--decode-uris" do
928
+ context '--decode-uris' do
929
929
  before(:each) do
930
- @search.options = @search.options.merge("decode_uris" => true)
931
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :include_entities => 1, :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("statuses.json"))
932
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:body => fixture("empty_array.json"))
930
+ @search.options = @search.options.merge('decode_uris' => true)
931
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :include_entities => 1, :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
932
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:body => fixture('empty_array.json'))
933
933
  end
934
- it "requests the correct resource" do
935
- @search.list("presidents", "twitter")
936
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :include_entities => 1, :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
937
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :include_entities => 1, :max_id => "244099460672679937", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
934
+ it 'requests the correct resource' do
935
+ @search.list('presidents', 'twitter')
936
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :include_entities => 1, :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
937
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :include_entities => 1, :max_id => '244099460672679937', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
938
938
  end
939
- it "decodes URLs" do
940
- @search.list("presidents", "twitter")
941
- expect($stdout.string).to include "https://dev.twitter.com/docs/api/post/direct_messages/destroy"
939
+ it 'decodes URLs' do
940
+ @search.list('presidents', 'twitter')
941
+ expect($stdout.string).to include 'https://dev.twitter.com/docs/api/post/direct_messages/destroy'
942
942
  end
943
943
  end
944
- context "--long" do
944
+ context '--long' do
945
945
  before do
946
- @search.options = @search.options.merge("long" => true)
946
+ @search.options = @search.options.merge('long' => true)
947
947
  end
948
- it "outputs in long format" do
949
- @search.list("presidents", "twitter")
948
+ it 'outputs in long format' do
949
+ @search.list('presidents', 'twitter')
950
950
  expect($stdout.string).to eq <<-eos
951
951
  ID Posted at Screen name Text
952
952
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
@@ -954,133 +954,133 @@ ID Posted at Screen name Text
954
954
  eos
955
955
  end
956
956
  end
957
- context "with a user passed" do
958
- it "requests the correct resource" do
959
- @search.list("testcli/presidents", "twitter")
960
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made
957
+ context 'with a user passed' do
958
+ it 'requests the correct resource' do
959
+ @search.list('testcli/presidents', 'twitter')
960
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made
961
961
  end
962
- context "--id" do
962
+ context '--id' do
963
963
  before do
964
- @search.options = @search.options.merge("id" => true)
965
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"}).to_return(:body => fixture("statuses.json"))
966
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"}).to_return(:body => fixture("empty_array.json"))
964
+ @search.options = @search.options.merge('id' => true)
965
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents'}).to_return(:body => fixture('statuses.json'))
966
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents'}).to_return(:body => fixture('empty_array.json'))
967
967
  end
968
- it "requests the correct resource" do
969
- @search.list("7505382/presidents", "twitter")
970
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_id => "7505382", :slug => "presidents"})).to have_been_made
971
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :max_id => "244099460672679937", :owner_id => "7505382", :slug => "presidents"})).to have_been_made
968
+ it 'requests the correct resource' do
969
+ @search.list('7505382/presidents', 'twitter')
970
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_id => '7505382', :slug => 'presidents'})).to have_been_made
971
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :max_id => '244099460672679937', :owner_id => '7505382', :slug => 'presidents'})).to have_been_made
972
972
  end
973
973
  end
974
974
  end
975
- context "Twitter is down" do
976
- it "retries 3 times and then raise an error" do
977
- stub_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"}).to_return(:status => 502)
975
+ context 'Twitter is down' do
976
+ it 'retries 3 times and then raise an error' do
977
+ stub_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'}).to_return(:status => 502)
978
978
  expect do
979
- @search.list("presidents", "twitter")
979
+ @search.list('presidents', 'twitter')
980
980
  end.to raise_error(Twitter::Error::BadGateway)
981
- expect(a_get("/1.1/lists/statuses.json").with(:query => {:count => "200", :owner_screen_name => "testcli", :slug => "presidents"})).to have_been_made.times(3)
981
+ expect(a_get('/1.1/lists/statuses.json').with(:query => {:count => '200', :owner_screen_name => 'testcli', :slug => 'presidents'})).to have_been_made.times(3)
982
982
  end
983
983
  end
984
984
  end
985
985
 
986
- describe "#retweets" do
986
+ describe '#retweets' do
987
987
  before do
988
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:body => fixture("statuses.json"))
989
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"))
988
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:body => fixture('statuses.json'))
989
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
990
990
  end
991
- it "requests the correct resource" do
992
- @search.retweets("mosaic")
993
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made
994
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :max_id => "244102729860009983"})).to have_been_made.times(2)
991
+ it 'requests the correct resource' do
992
+ @search.retweets('mosaic')
993
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made
994
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :max_id => '244102729860009983'})).to have_been_made.times(2)
995
995
  end
996
- it "has the correct output" do
997
- @search.retweets("mosaic")
996
+ it 'has the correct output' do
997
+ @search.retweets('mosaic')
998
998
  expect($stdout.string).to eq <<-eos
999
999
  @calebelston
1000
1000
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
1001
1001
 
1002
1002
  eos
1003
1003
  end
1004
- context "--csv" do
1004
+ context '--csv' do
1005
1005
  before do
1006
- @search.options = @search.options.merge("csv" => true)
1006
+ @search.options = @search.options.merge('csv' => true)
1007
1007
  end
1008
- it "outputs in CSV format" do
1009
- @search.retweets("mosaic")
1008
+ it 'outputs in CSV format' do
1009
+ @search.retweets('mosaic')
1010
1010
  expect($stdout.string).to eq <<-eos
1011
1011
  ID,Posted at,Screen name,Text
1012
1012
  244108728834592770,2012-09-07 16:23:50 +0000,calebelston,RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
1013
1013
  eos
1014
1014
  end
1015
1015
  end
1016
- context "--decode-uris" do
1016
+ context '--decode-uris' do
1017
1017
  before(:each) do
1018
- @search.options = @search.options.merge("decode_uris" => true)
1019
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_entities => 1, :include_rts => "true"}).to_return(:body => fixture("statuses.json"))
1020
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_entities => 1, :include_rts => "true", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"))
1018
+ @search.options = @search.options.merge('decode_uris' => true)
1019
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_entities => 1, :include_rts => 'true'}).to_return(:body => fixture('statuses.json'))
1020
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_entities => 1, :include_rts => 'true', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
1021
1021
  end
1022
- it "requests the correct resource" do
1023
- @search.retweets("mosaic")
1024
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_entities => 1, :include_rts => "true"})).to have_been_made
1025
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_entities => 1, :include_rts => "true", :max_id => "244102729860009983"})).to have_been_made.times(2)
1022
+ it 'requests the correct resource' do
1023
+ @search.retweets('mosaic')
1024
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_entities => 1, :include_rts => 'true'})).to have_been_made
1025
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_entities => 1, :include_rts => 'true', :max_id => '244102729860009983'})).to have_been_made.times(2)
1026
1026
  end
1027
- it "decodes URLs" do
1028
- @search.retweets("mosaic")
1029
- expect($stdout.string).to include "http://heymosaic.com/i/1Z8ssK"
1027
+ it 'decodes URLs' do
1028
+ @search.retweets('mosaic')
1029
+ expect($stdout.string).to include 'http://heymosaic.com/i/1Z8ssK'
1030
1030
  end
1031
1031
  end
1032
- context "--long" do
1032
+ context '--long' do
1033
1033
  before do
1034
- @search.options = @search.options.merge("long" => true)
1034
+ @search.options = @search.options.merge('long' => true)
1035
1035
  end
1036
- it "outputs in long format" do
1037
- @search.retweets("mosaic")
1036
+ it 'outputs in long format' do
1037
+ @search.retweets('mosaic')
1038
1038
  expect($stdout.string).to eq <<-eos
1039
1039
  ID Posted at Screen name Text
1040
1040
  244108728834592770 Sep 7 08:23 @calebelston RT @olivercameron: Mosaic loo...
1041
1041
  eos
1042
1042
  end
1043
1043
  end
1044
- context "Twitter is down" do
1045
- it "retries 3 times and then raise an error" do
1046
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"}).to_return(:status => 502)
1044
+ context 'Twitter is down' do
1045
+ it 'retries 3 times and then raise an error' do
1046
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'}).to_return(:status => 502)
1047
1047
  expect do
1048
- @search.retweets("mosaic")
1048
+ @search.retweets('mosaic')
1049
1049
  end.to raise_error(Twitter::Error::BadGateway)
1050
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true"})).to have_been_made.times(3)
1050
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true'})).to have_been_made.times(3)
1051
1051
  end
1052
1052
  end
1053
- context "with a user passed" do
1053
+ context 'with a user passed' do
1054
1054
  before do
1055
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
1056
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"))
1055
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
1056
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
1057
1057
  end
1058
- it "requests the correct resource" do
1059
- @search.retweets("sferik", "mosaic")
1060
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik"})).to have_been_made
1061
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :screen_name => "sferik", :max_id => "244102729860009983"})).to have_been_made.times(2)
1058
+ it 'requests the correct resource' do
1059
+ @search.retweets('sferik', 'mosaic')
1060
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik'})).to have_been_made
1061
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :screen_name => 'sferik', :max_id => '244102729860009983'})).to have_been_made.times(2)
1062
1062
  end
1063
- it "has the correct output" do
1064
- @search.retweets("sferik", "mosaic")
1063
+ it 'has the correct output' do
1064
+ @search.retweets('sferik', 'mosaic')
1065
1065
  expect($stdout.string).to eq <<-eos
1066
1066
  @calebelston
1067
1067
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
1068
1068
 
1069
1069
  eos
1070
1070
  end
1071
- context "--id" do
1071
+ context '--id' do
1072
1072
  before do
1073
- @search.options = @search.options.merge("id" => true)
1074
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"))
1075
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"}).to_return(:body => fixture("empty_array.json"))
1073
+ @search.options = @search.options.merge('id' => true)
1074
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
1075
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'}).to_return(:body => fixture('empty_array.json'))
1076
1076
  end
1077
- it "requests the correct resource" do
1078
- @search.retweets("7505382", "mosaic")
1079
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382"})).to have_been_made
1080
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :include_rts => "true", :user_id => "7505382", :max_id => "244102729860009983"})).to have_been_made.times(2)
1077
+ it 'requests the correct resource' do
1078
+ @search.retweets('7505382', 'mosaic')
1079
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382'})).to have_been_made
1080
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :include_rts => 'true', :user_id => '7505382', :max_id => '244102729860009983'})).to have_been_made.times(2)
1081
1081
  end
1082
- it "has the correct output" do
1083
- @search.retweets("7505382", "mosaic")
1082
+ it 'has the correct output' do
1083
+ @search.retweets('7505382', 'mosaic')
1084
1084
  expect($stdout.string).to eq <<-eos
1085
1085
  @calebelston
1086
1086
  RT @olivercameron: Mosaic looks cool: http://t.co/A8013C9k
@@ -1091,18 +1091,18 @@ ID Posted at Screen name Text
1091
1091
  end
1092
1092
  end
1093
1093
 
1094
- describe "#timeline" do
1094
+ describe '#timeline' do
1095
1095
  before do
1096
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:body => fixture("statuses.json"))
1097
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
1096
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'}).to_return(:body => fixture('statuses.json'))
1097
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
1098
1098
  end
1099
- it "requests the correct resource" do
1100
- @search.timeline("twitter")
1101
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made
1102
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937"})).to have_been_made
1099
+ it 'requests the correct resource' do
1100
+ @search.timeline('twitter')
1101
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'})).to have_been_made
1102
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937'})).to have_been_made
1103
1103
  end
1104
- it "has the correct output" do
1105
- @search.timeline("twitter")
1104
+ it 'has the correct output' do
1105
+ @search.timeline('twitter')
1106
1106
  expect($stdout.string).to eq <<-eos
1107
1107
  @sferik
1108
1108
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -1113,12 +1113,12 @@ ID Posted at Screen name Text
1113
1113
 
1114
1114
  eos
1115
1115
  end
1116
- context "--csv" do
1116
+ context '--csv' do
1117
1117
  before do
1118
- @search.options = @search.options.merge("csv" => true)
1118
+ @search.options = @search.options.merge('csv' => true)
1119
1119
  end
1120
- it "outputs in CSV format" do
1121
- @search.timeline("twitter")
1120
+ it 'outputs in CSV format' do
1121
+ @search.timeline('twitter')
1122
1122
  expect($stdout.string).to eq <<-eos
1123
1123
  ID,Posted at,Screen name,Text
1124
1124
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
@@ -1126,52 +1126,52 @@ ID,Posted at,Screen name,Text
1126
1126
  eos
1127
1127
  end
1128
1128
  end
1129
- context "--decode-uris" do
1129
+ context '--decode-uris' do
1130
1130
  before(:each) do
1131
- @search.options = @search.options.merge("decode_uris" => true)
1132
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_entities => 1}).to_return(:body => fixture("statuses.json"))
1133
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :include_entities => 1}).to_return(:body => fixture("empty_array.json"))
1131
+ @search.options = @search.options.merge('decode_uris' => true)
1132
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 1}).to_return(:body => fixture('statuses.json'))
1133
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 1}).to_return(:body => fixture('empty_array.json'))
1134
1134
  end
1135
- it "requests the correct resource" do
1136
- @search.timeline("twitter")
1137
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_entities => 1})).to have_been_made
1138
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :include_entities => 1})).to have_been_made
1135
+ it 'requests the correct resource' do
1136
+ @search.timeline('twitter')
1137
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_entities => 1})).to have_been_made
1138
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :include_entities => 1})).to have_been_made
1139
1139
  end
1140
- it "decodes URLs" do
1141
- @search.timeline("twitter")
1142
- expect($stdout.string).to include "https://dev.twitter.com/docs/api/post/direct_messages/destroy"
1140
+ it 'decodes URLs' do
1141
+ @search.timeline('twitter')
1142
+ expect($stdout.string).to include 'https://dev.twitter.com/docs/api/post/direct_messages/destroy'
1143
1143
  end
1144
1144
  end
1145
- context "--exclude=replies" do
1145
+ context '--exclude=replies' do
1146
1146
  before do
1147
- @search.options = @search.options.merge("exclude" => "replies")
1148
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :exclude_replies => "true"}).to_return(:body => fixture("statuses.json"))
1149
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :exclude_replies => "true", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
1147
+ @search.options = @search.options.merge('exclude' => 'replies')
1148
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true'}).to_return(:body => fixture('statuses.json'))
1149
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
1150
1150
  end
1151
- it "excludes replies" do
1151
+ it 'excludes replies' do
1152
1152
  @search.timeline
1153
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :exclude_replies => "true"})).to have_been_made
1154
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :exclude_replies => "true", :max_id => "244099460672679937"})).to have_been_made
1153
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true'})).to have_been_made
1154
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :exclude_replies => 'true', :max_id => '244099460672679937'})).to have_been_made
1155
1155
  end
1156
1156
  end
1157
- context "--exclude=retweets" do
1157
+ context '--exclude=retweets' do
1158
1158
  before do
1159
- @search.options = @search.options.merge("exclude" => "retweets")
1160
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_rts => "false"}).to_return(:body => fixture("statuses.json"))
1161
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_rts => "false", :max_id => "244099460672679937"}).to_return(:body => fixture("empty_array.json"))
1159
+ @search.options = @search.options.merge('exclude' => 'retweets')
1160
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false'}).to_return(:body => fixture('statuses.json'))
1161
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937'}).to_return(:body => fixture('empty_array.json'))
1162
1162
  end
1163
- it "excludes retweets" do
1163
+ it 'excludes retweets' do
1164
1164
  @search.timeline
1165
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_rts => "false"})).to have_been_made
1166
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :include_rts => "false", :max_id => "244099460672679937"})).to have_been_made
1165
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false'})).to have_been_made
1166
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :include_rts => 'false', :max_id => '244099460672679937'})).to have_been_made
1167
1167
  end
1168
1168
  end
1169
- context "--long" do
1169
+ context '--long' do
1170
1170
  before do
1171
- @search.options = @search.options.merge("long" => true)
1171
+ @search.options = @search.options.merge('long' => true)
1172
1172
  end
1173
- it "outputs in long format" do
1174
- @search.timeline("twitter")
1173
+ it 'outputs in long format' do
1174
+ @search.timeline('twitter')
1175
1175
  expect($stdout.string).to eq <<-eos
1176
1176
  ID Posted at Screen name Text
1177
1177
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
@@ -1179,49 +1179,49 @@ ID Posted at Screen name Text
1179
1179
  eos
1180
1180
  end
1181
1181
  end
1182
- context "--max-id" do
1182
+ context '--max-id' do
1183
1183
  before do
1184
- @search.options = @search.options.merge("max_id" => 244104558433951744)
1185
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
1184
+ @search.options = @search.options.merge('max_id' => 244_104_558_433_951_744)
1185
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1186
1186
  end
1187
- it "requests the correct resource" do
1188
- @search.timeline("twitter")
1189
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244104558433951744"})).to have_been_made
1187
+ it 'requests the correct resource' do
1188
+ @search.timeline('twitter')
1189
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244104558433951744'})).to have_been_made
1190
1190
  end
1191
1191
  end
1192
- context "--since-id" do
1192
+ context '--since-id' do
1193
1193
  before do
1194
- @search.options = @search.options.merge("since_id" => 244104558433951744)
1195
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :since_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
1196
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :since_id => "244104558433951744"}).to_return(:body => fixture("empty_array.json"))
1194
+ @search.options = @search.options.merge('since_id' => 244_104_558_433_951_744)
1195
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1196
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744'}).to_return(:body => fixture('empty_array.json'))
1197
1197
  end
1198
- it "requests the correct resource" do
1199
- @search.timeline("twitter")
1200
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :since_id => "244104558433951744"})).to have_been_made
1201
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :since_id => "244104558433951744"})).to have_been_made
1198
+ it 'requests the correct resource' do
1199
+ @search.timeline('twitter')
1200
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :since_id => '244104558433951744'})).to have_been_made
1201
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :since_id => '244104558433951744'})).to have_been_made
1202
1202
  end
1203
1203
  end
1204
- context "Twitter is down" do
1205
- it "retries 3 times and then raise an error" do
1206
- stub_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"}).to_return(:status => 502)
1204
+ context 'Twitter is down' do
1205
+ it 'retries 3 times and then raise an error' do
1206
+ stub_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'}).to_return(:status => 502)
1207
1207
  expect do
1208
- @search.timeline("twitter")
1208
+ @search.timeline('twitter')
1209
1209
  end.to raise_error(Twitter::Error::BadGateway)
1210
- expect(a_get("/1.1/statuses/home_timeline.json").with(:query => {:count => "200"})).to have_been_made.times(3)
1210
+ expect(a_get('/1.1/statuses/home_timeline.json').with(:query => {:count => '200'})).to have_been_made.times(3)
1211
1211
  end
1212
1212
  end
1213
- context "with a user passed" do
1213
+ context 'with a user passed' do
1214
1214
  before do
1215
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"}).to_return(:body => fixture("statuses.json"))
1216
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"}).to_return(:body => fixture("empty_array.json"))
1215
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'}).to_return(:body => fixture('statuses.json'))
1216
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'}).to_return(:body => fixture('empty_array.json'))
1217
1217
  end
1218
- it "requests the correct resource" do
1219
- @search.timeline("sferik", "twitter")
1220
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik"})).to have_been_made
1221
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :screen_name => "sferik"})).to have_been_made
1218
+ it 'requests the correct resource' do
1219
+ @search.timeline('sferik', 'twitter')
1220
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik'})).to have_been_made
1221
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :screen_name => 'sferik'})).to have_been_made
1222
1222
  end
1223
- it "has the correct output" do
1224
- @search.timeline("sferik", "twitter")
1223
+ it 'has the correct output' do
1224
+ @search.timeline('sferik', 'twitter')
1225
1225
  expect($stdout.string).to eq <<-eos
1226
1226
  @sferik
1227
1227
  @episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem
@@ -1232,12 +1232,12 @@ ID Posted at Screen name Text
1232
1232
 
1233
1233
  eos
1234
1234
  end
1235
- context "--csv" do
1235
+ context '--csv' do
1236
1236
  before do
1237
- @search.options = @search.options.merge("csv" => true)
1237
+ @search.options = @search.options.merge('csv' => true)
1238
1238
  end
1239
- it "outputs in CSV format" do
1240
- @search.timeline("sferik", "twitter")
1239
+ it 'outputs in CSV format' do
1240
+ @search.timeline('sferik', 'twitter')
1241
1241
  expect($stdout.string).to eq <<-eos
1242
1242
  ID,Posted at,Screen name,Text
1243
1243
  244102209942458368,2012-09-07 15:57:56 +0000,sferik,"@episod @twitterapi now https://t.co/I17jUTu2 and https://t.co/deDu4Hgw seem to be missing ""1.1"" from the URL."
@@ -1245,24 +1245,24 @@ ID,Posted at,Screen name,Text
1245
1245
  eos
1246
1246
  end
1247
1247
  end
1248
- context "--id" do
1248
+ context '--id' do
1249
1249
  before do
1250
- @search.options = @search.options.merge("id" => true)
1251
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :user_id => "7505382"}).to_return(:body => fixture("statuses.json"))
1252
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"}).to_return(:body => fixture("empty_array.json"))
1250
+ @search.options = @search.options.merge('id' => true)
1251
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382'}).to_return(:body => fixture('statuses.json'))
1252
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'}).to_return(:body => fixture('empty_array.json'))
1253
1253
  end
1254
- it "requests the correct resource" do
1255
- @search.timeline("7505382", "twitter")
1256
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :user_id => "7505382"})).to have_been_made
1257
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :max_id => "244099460672679937", :user_id => "7505382"})).to have_been_made
1254
+ it 'requests the correct resource' do
1255
+ @search.timeline('7505382', 'twitter')
1256
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :user_id => '7505382'})).to have_been_made
1257
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :max_id => '244099460672679937', :user_id => '7505382'})).to have_been_made
1258
1258
  end
1259
1259
  end
1260
- context "--long" do
1260
+ context '--long' do
1261
1261
  before do
1262
- @search.options = @search.options.merge("long" => true)
1262
+ @search.options = @search.options.merge('long' => true)
1263
1263
  end
1264
- it "outputs in long format" do
1265
- @search.timeline("sferik", "twitter")
1264
+ it 'outputs in long format' do
1265
+ @search.timeline('sferik', 'twitter')
1266
1266
  expect($stdout.string).to eq <<-eos
1267
1267
  ID Posted at Screen name Text
1268
1268
  244102209942458368 Sep 7 07:57 @sferik @episod @twitterapi now https:...
@@ -1270,62 +1270,62 @@ ID Posted at Screen name Text
1270
1270
  eos
1271
1271
  end
1272
1272
  end
1273
- context "--max-id" do
1273
+ context '--max-id' do
1274
1274
  before do
1275
- @search.options = @search.options.merge("max_id" => 244104558433951744)
1276
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
1275
+ @search.options = @search.options.merge('max_id' => 244_104_558_433_951_744)
1276
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1277
1277
  end
1278
- it "requests the correct resource" do
1279
- @search.timeline("sferik", "twitter")
1280
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244104558433951744"})).to have_been_made
1278
+ it 'requests the correct resource' do
1279
+ @search.timeline('sferik', 'twitter')
1280
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244104558433951744'})).to have_been_made
1281
1281
  end
1282
1282
  end
1283
- context "--since-id" do
1283
+ context '--since-id' do
1284
1284
  before do
1285
- @search.options = @search.options.merge("since_id" => 244104558433951744)
1286
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :since_id => "244104558433951744"}).to_return(:body => fixture("statuses.json"))
1287
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937", :since_id => "244104558433951744"}).to_return(:body => fixture("empty_array.json"))
1285
+ @search.options = @search.options.merge('since_id' => 244_104_558_433_951_744)
1286
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744'}).to_return(:body => fixture('statuses.json'))
1287
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744'}).to_return(:body => fixture('empty_array.json'))
1288
1288
  end
1289
- it "requests the correct resource" do
1290
- @search.timeline("sferik", "twitter")
1291
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :since_id => "244104558433951744"})).to have_been_made
1292
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:count => "200", :screen_name => "sferik", :max_id => "244099460672679937", :since_id => "244104558433951744"})).to have_been_made
1289
+ it 'requests the correct resource' do
1290
+ @search.timeline('sferik', 'twitter')
1291
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :since_id => '244104558433951744'})).to have_been_made
1292
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:count => '200', :screen_name => 'sferik', :max_id => '244099460672679937', :since_id => '244104558433951744'})).to have_been_made
1293
1293
  end
1294
1294
  end
1295
- context "Twitter is down" do
1296
- it "retries 3 times and then raise an error" do
1297
- stub_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik", :count => "200"}).to_return(:status => 502)
1295
+ context 'Twitter is down' do
1296
+ it 'retries 3 times and then raise an error' do
1297
+ stub_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200'}).to_return(:status => 502)
1298
1298
  expect do
1299
- @search.timeline("sferik", "twitter")
1299
+ @search.timeline('sferik', 'twitter')
1300
1300
  end.to raise_error(Twitter::Error::BadGateway)
1301
- expect(a_get("/1.1/statuses/user_timeline.json").with(:query => {:screen_name => "sferik", :count => "200"})).to have_been_made.times(3)
1301
+ expect(a_get('/1.1/statuses/user_timeline.json').with(:query => {:screen_name => 'sferik', :count => '200'})).to have_been_made.times(3)
1302
1302
  end
1303
1303
  end
1304
1304
  end
1305
1305
  end
1306
1306
 
1307
- describe "#users" do
1307
+ describe '#users' do
1308
1308
  before do
1309
- stub_get("/1.1/users/search.json").with(:query => {:page => "1", :q => "Erik"}).to_return(:body => fixture("users.json"))
1310
- stub_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik"}).to_return(:body => fixture("empty_array.json"))
1309
+ stub_get('/1.1/users/search.json').with(:query => {:page => '1', :q => 'Erik'}).to_return(:body => fixture('users.json'))
1310
+ stub_get('/1.1/users/search.json').with(:query => {:page => '2', :q => 'Erik'}).to_return(:body => fixture('empty_array.json'))
1311
1311
  end
1312
- it "requests the correct resource" do
1313
- @search.users("Erik")
1312
+ it 'requests the correct resource' do
1313
+ @search.users('Erik')
1314
1314
  1.upto(50).each do |page|
1315
- expect(a_get("/1.1/users/search.json").with(:query => {:page => "1", :q => "Erik"})).to have_been_made
1316
- expect(a_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik"})).to have_been_made
1315
+ expect(a_get('/1.1/users/search.json').with(:query => {:page => '1', :q => 'Erik'})).to have_been_made
1316
+ expect(a_get('/1.1/users/search.json').with(:query => {:page => '2', :q => 'Erik'})).to have_been_made
1317
1317
  end
1318
1318
  end
1319
- it "has the correct output" do
1320
- @search.users("Erik")
1321
- expect($stdout.string.chomp).to eq "pengwynn sferik"
1319
+ it 'has the correct output' do
1320
+ @search.users('Erik')
1321
+ expect($stdout.string.chomp).to eq 'pengwynn sferik'
1322
1322
  end
1323
- context "--csv" do
1323
+ context '--csv' do
1324
1324
  before do
1325
- @search.options = @search.options.merge("csv" => true)
1325
+ @search.options = @search.options.merge('csv' => true)
1326
1326
  end
1327
- it "outputs in CSV format" do
1328
- @search.users("Erik")
1327
+ it 'outputs in CSV format' do
1328
+ @search.users('Erik')
1329
1329
  expect($stdout.string).to eq <<-eos
1330
1330
  ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name,Name,Verified,Protected,Bio,Status,Location,URL
1331
1331
  14100886,2008-03-08 16:34:22 +0000,2012-07-07 20:33:19 +0000,6940,192,358,3427,5457,pengwynn,Wynn Netherland,false,false,"Christian, husband, father, GitHubber, Co-host of @thechangelog, Co-author of Sass, Compass, #CSS book http://wynn.fm/sass-meap",@akosmasoftware Sass book! @hcatlin @nex3 are the brains behind Sass. :-),"Denton, TX",http://wynnnetherland.com
@@ -1333,12 +1333,12 @@ ID,Since,Last tweeted at,Tweets,Favorites,Listed,Following,Followers,Screen name
1333
1333
  eos
1334
1334
  end
1335
1335
  end
1336
- context "--long" do
1336
+ context '--long' do
1337
1337
  before do
1338
- @search.options = @search.options.merge("long" => true)
1338
+ @search.options = @search.options.merge('long' => true)
1339
1339
  end
1340
- it "outputs in long format" do
1341
- @search.users("Erik")
1340
+ it 'outputs in long format' do
1341
+ @search.users('Erik')
1342
1342
  expect($stdout.string).to eq <<-eos
1343
1343
  ID Since Last tweeted at Tweets Favorites Listed Following...
1344
1344
  14100886 Mar 8 2008 Jul 7 12:33 6940 192 358 3427...
@@ -1346,94 +1346,94 @@ ID Since Last tweeted at Tweets Favorites Listed Following...
1346
1346
  eos
1347
1347
  end
1348
1348
  end
1349
- context "--reverse" do
1349
+ context '--reverse' do
1350
1350
  before do
1351
- @search.options = @search.options.merge("reverse" => true)
1351
+ @search.options = @search.options.merge('reverse' => true)
1352
1352
  end
1353
- it "reverses the order of the sort" do
1354
- @search.users("Erik")
1355
- expect($stdout.string.chomp).to eq "sferik pengwynn"
1353
+ it 'reverses the order of the sort' do
1354
+ @search.users('Erik')
1355
+ expect($stdout.string.chomp).to eq 'sferik pengwynn'
1356
1356
  end
1357
1357
  end
1358
- context "--sort=favorites" do
1358
+ context '--sort=favorites' do
1359
1359
  before do
1360
- @search.options = @search.options.merge("sort" => "favorites")
1360
+ @search.options = @search.options.merge('sort' => 'favorites')
1361
1361
  end
1362
- it "sorts by number of favorites" do
1363
- @search.users("Erik")
1364
- expect($stdout.string.chomp).to eq "pengwynn sferik"
1362
+ it 'sorts by the number of favorites' do
1363
+ @search.users('Erik')
1364
+ expect($stdout.string.chomp).to eq 'pengwynn sferik'
1365
1365
  end
1366
1366
  end
1367
- context "--sort=followers" do
1367
+ context '--sort=followers' do
1368
1368
  before do
1369
- @search.options = @search.options.merge("sort" => "followers")
1369
+ @search.options = @search.options.merge('sort' => 'followers')
1370
1370
  end
1371
- it "sorts by number of followers" do
1372
- @search.users("Erik")
1373
- expect($stdout.string.chomp).to eq "sferik pengwynn"
1371
+ it 'sorts by the number of followers' do
1372
+ @search.users('Erik')
1373
+ expect($stdout.string.chomp).to eq 'sferik pengwynn'
1374
1374
  end
1375
1375
  end
1376
- context "--sort=friends" do
1376
+ context '--sort=friends' do
1377
1377
  before do
1378
- @search.options = @search.options.merge("sort" => "friends")
1378
+ @search.options = @search.options.merge('sort' => 'friends')
1379
1379
  end
1380
- it "sorts by number of friends" do
1381
- @search.users("Erik")
1382
- expect($stdout.string.chomp).to eq "sferik pengwynn"
1380
+ it 'sorts by the number of friends' do
1381
+ @search.users('Erik')
1382
+ expect($stdout.string.chomp).to eq 'sferik pengwynn'
1383
1383
  end
1384
1384
  end
1385
- context "--sort=listed" do
1385
+ context '--sort=listed' do
1386
1386
  before do
1387
- @search.options = @search.options.merge("sort" => "listed")
1387
+ @search.options = @search.options.merge('sort' => 'listed')
1388
1388
  end
1389
- it "sorts by number of list memberships" do
1390
- @search.users("Erik")
1391
- expect($stdout.string.chomp).to eq "sferik pengwynn"
1389
+ it 'sorts by the number of list memberships' do
1390
+ @search.users('Erik')
1391
+ expect($stdout.string.chomp).to eq 'sferik pengwynn'
1392
1392
  end
1393
1393
  end
1394
- context "--sort=since" do
1394
+ context '--sort=since' do
1395
1395
  before do
1396
- @search.options = @search.options.merge("sort" => "since")
1396
+ @search.options = @search.options.merge('sort' => 'since')
1397
1397
  end
1398
- it "sorts by the time wshen Twitter account was created" do
1399
- @search.users("Erik")
1400
- expect($stdout.string.chomp).to eq "sferik pengwynn"
1398
+ it 'sorts by the time when Twitter account was created' do
1399
+ @search.users('Erik')
1400
+ expect($stdout.string.chomp).to eq 'sferik pengwynn'
1401
1401
  end
1402
1402
  end
1403
- context "--sort=tweets" do
1403
+ context '--sort=tweets' do
1404
1404
  before do
1405
- @search.options = @search.options.merge("sort" => "tweets")
1405
+ @search.options = @search.options.merge('sort' => 'tweets')
1406
1406
  end
1407
- it "sorts by number of Tweets" do
1408
- @search.users("Erik")
1409
- expect($stdout.string.chomp).to eq "pengwynn sferik"
1407
+ it 'sorts by the number of Tweets' do
1408
+ @search.users('Erik')
1409
+ expect($stdout.string.chomp).to eq 'pengwynn sferik'
1410
1410
  end
1411
1411
  end
1412
- context "--sort=tweeted" do
1412
+ context '--sort=tweeted' do
1413
1413
  before do
1414
- @search.options = @search.options.merge("sort" => "tweeted")
1414
+ @search.options = @search.options.merge('sort' => 'tweeted')
1415
1415
  end
1416
- it "sorts by the time of the last Tweet" do
1417
- @search.users("Erik")
1418
- expect($stdout.string.chomp).to eq "pengwynn sferik"
1416
+ it 'sorts by the time of the last Tweet' do
1417
+ @search.users('Erik')
1418
+ expect($stdout.string.chomp).to eq 'pengwynn sferik'
1419
1419
  end
1420
1420
  end
1421
- context "--unsorted" do
1421
+ context '--unsorted' do
1422
1422
  before do
1423
- @search.options = @search.options.merge("unsorted" => true)
1423
+ @search.options = @search.options.merge('unsorted' => true)
1424
1424
  end
1425
- it "is not sorted" do
1426
- @search.users("Erik")
1427
- expect($stdout.string.chomp).to eq "pengwynn sferik"
1425
+ it 'is not sorted' do
1426
+ @search.users('Erik')
1427
+ expect($stdout.string.chomp).to eq 'pengwynn sferik'
1428
1428
  end
1429
1429
  end
1430
- context "Twitter is down" do
1431
- it "retries 3 times and then raise an error" do
1432
- stub_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik", }).to_return(:status => 502)
1430
+ context 'Twitter is down' do
1431
+ it 'retries 3 times and then raise an error' do
1432
+ stub_get('/1.1/users/search.json').with(:query => {:page => '2', :q => 'Erik'}).to_return(:status => 502)
1433
1433
  expect do
1434
- @search.users("Erik")
1434
+ @search.users('Erik')
1435
1435
  end.to raise_error(Twitter::Error::BadGateway)
1436
- expect(a_get("/1.1/users/search.json").with(:query => {:page => "2", :q => "Erik", })).to have_been_made.times(3)
1436
+ expect(a_get('/1.1/users/search.json').with(:query => {:page => '2', :q => 'Erik'})).to have_been_made.times(3)
1437
1437
  end
1438
1438
  end
1439
1439
  end