t 1.3.0 → 1.3.1

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/delete_spec.rb CHANGED
@@ -21,32 +21,24 @@ describe T::Delete do
21
21
  describe "#block" do
22
22
  before do
23
23
  @delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
24
- stub_post("/1.1/blocks/destroy.json").
25
- with(:body => {:screen_name => "sferik"}).
26
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
24
+ stub_post("/1.1/blocks/destroy.json").with(:body => {:screen_name => "sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
27
25
  end
28
26
  it "should request the correct resource" do
29
27
  @delete.block("sferik")
30
- a_post("/1.1/blocks/destroy.json").
31
- with(:body => {:screen_name => "sferik"}).
32
- should have_been_made
28
+ expect(a_post("/1.1/blocks/destroy.json").with(:body => {:screen_name => "sferik"})).to have_been_made
33
29
  end
34
30
  it "should have the correct output" do
35
31
  @delete.block("sferik")
36
- $stdout.string.should =~ /^@testcli unblocked 1 user\.$/
32
+ expect($stdout.string).to match /^@testcli unblocked 1 user\.$/
37
33
  end
38
34
  context "--id" do
39
35
  before do
40
36
  @delete.options = @delete.options.merge("id" => true)
41
- stub_post("/1.1/blocks/destroy.json").
42
- with(:body => {:user_id => "7505382"}).
43
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
37
+ stub_post("/1.1/blocks/destroy.json").with(:body => {:user_id => "7505382"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
44
38
  end
45
39
  it "should request the correct resource" do
46
40
  @delete.block("7505382")
47
- a_post("/1.1/blocks/destroy.json").
48
- with(:body => {:user_id => "7505382"}).
49
- should have_been_made
41
+ expect(a_post("/1.1/blocks/destroy.json").with(:body => {:user_id => "7505382"})).to have_been_made
50
42
  end
51
43
  end
52
44
  end
@@ -54,30 +46,22 @@ describe T::Delete do
54
46
  describe "#dm" do
55
47
  before do
56
48
  @delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
57
- stub_get("/1.1/direct_messages/show.json").
58
- with(:query => {:id => "1773478249"}).
59
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
60
- stub_post("/1.1/direct_messages/destroy.json").
61
- with(:body => {:id => "1773478249"}).
62
- to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
49
+ stub_get("/1.1/direct_messages/show.json").with(:query => {:id => "1773478249"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
50
+ stub_post("/1.1/direct_messages/destroy.json").with(:body => {:id => "1773478249"}).to_return(:body => fixture("direct_message.json"), :headers => {:content_type => "application/json; charset=utf-8"})
63
51
  end
64
52
  it "should request the correct resource" do
65
53
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
66
54
  $stdin.should_receive(:gets).and_return("yes")
67
55
  @delete.dm("1773478249")
68
- a_get("/1.1/direct_messages/show.json").
69
- with(:query => {:id => "1773478249"}).
70
- should have_been_made
71
- a_post("/1.1/direct_messages/destroy.json").
72
- with(:body => {:id => "1773478249"}).
73
- should have_been_made
56
+ expect(a_get("/1.1/direct_messages/show.json").with(:query => {:id => "1773478249"})).to have_been_made
57
+ expect(a_post("/1.1/direct_messages/destroy.json").with(:body => {:id => "1773478249"})).to have_been_made
74
58
  end
75
59
  context "yes" do
76
60
  it "should have the correct output" do
77
61
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
78
62
  $stdin.should_receive(:gets).and_return("yes")
79
63
  @delete.dm("1773478249")
80
- $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
64
+ expect($stdout.string.chomp).to eq "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
81
65
  end
82
66
  end
83
67
  context "no" do
@@ -85,7 +69,7 @@ describe T::Delete do
85
69
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the direct message to @pengwynn: \"Creating a fixture for the Twitter gem\"? [y/N] ")
86
70
  $stdin.should_receive(:gets).and_return("no")
87
71
  @delete.dm("1773478249")
88
- $stdout.string.chomp.should be_empty
72
+ expect($stdout.string.chomp).to be_empty
89
73
  end
90
74
  end
91
75
  context "--force" do
@@ -94,13 +78,11 @@ describe T::Delete do
94
78
  end
95
79
  it "should request the correct resource" do
96
80
  @delete.dm("1773478249")
97
- a_post("/1.1/direct_messages/destroy.json").
98
- with(:body => {:id => "1773478249"}).
99
- should have_been_made
81
+ expect(a_post("/1.1/direct_messages/destroy.json").with(:body => {:id => "1773478249"})).to have_been_made
100
82
  end
101
83
  it "should have the correct output" do
102
84
  @delete.dm("1773478249")
103
- $stdout.string.chomp.should == "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
85
+ expect($stdout.string.chomp).to eq "@testcli deleted the direct message sent to @pengwynn: \"Creating a fixture for the Twitter gem\""
104
86
  end
105
87
  end
106
88
  end
@@ -108,30 +90,22 @@ describe T::Delete do
108
90
  describe "#favorite" do
109
91
  before do
110
92
  @delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
111
- stub_get("/1.1/statuses/show/28439861609.json").
112
- with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
113
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
114
- stub_post("/1.1/favorites/destroy.json").
115
- with(:body => {:id => "28439861609"}).
116
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
93
+ stub_get("/1.1/statuses/show/28439861609.json").with(:query => {:include_my_retweet => "false", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
94
+ stub_post("/1.1/favorites/destroy.json").with(:body => {:id => "28439861609"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
117
95
  end
118
96
  it "should request the correct resource" do
119
97
  $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
120
98
  $stdin.should_receive(:gets).and_return("yes")
121
99
  @delete.favorite("28439861609")
122
- a_get("/1.1/statuses/show/28439861609.json").
123
- with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
124
- should have_been_made
125
- a_post("/1.1/favorites/destroy.json").
126
- with(:body => {:id => "28439861609"}).
127
- should have_been_made
100
+ expect(a_get("/1.1/statuses/show/28439861609.json").with(:query => {:include_my_retweet => "false", :trim_user => "true"})).to have_been_made
101
+ expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "28439861609"})).to have_been_made
128
102
  end
129
103
  context "yes" do
130
104
  it "should have the correct output" do
131
105
  $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
132
106
  $stdin.should_receive(:gets).and_return("yes")
133
107
  @delete.favorite("28439861609")
134
- $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
108
+ expect($stdout.string).to match /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
135
109
  end
136
110
  end
137
111
  context "no" do
@@ -139,7 +113,7 @@ describe T::Delete do
139
113
  $stdout.should_receive(:print).with("Are you sure you want to remove @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\" from your favorites? [y/N] ")
140
114
  $stdin.should_receive(:gets).and_return("no")
141
115
  @delete.favorite("28439861609")
142
- $stdout.string.chomp.should be_empty
116
+ expect($stdout.string.chomp).to be_empty
143
117
  end
144
118
  end
145
119
  context "--force" do
@@ -148,13 +122,11 @@ describe T::Delete do
148
122
  end
149
123
  it "should request the correct resource" do
150
124
  @delete.favorite("28439861609")
151
- a_post("/1.1/favorites/destroy.json").
152
- with(:body => {:id => "28439861609"}).
153
- should have_been_made
125
+ expect(a_post("/1.1/favorites/destroy.json").with(:body => {:id => "28439861609"})).to have_been_made
154
126
  end
155
127
  it "should have the correct output" do
156
128
  @delete.favorite("28439861609")
157
- $stdout.string.should =~ /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
129
+ expect($stdout.string).to match /^@testcli unfavorited @sferik's status: "The problem with your code is that it's doing exactly what you told it to do\."$/
158
130
  end
159
131
  end
160
132
  end
@@ -162,31 +134,23 @@ describe T::Delete do
162
134
  describe "#list" do
163
135
  before do
164
136
  @delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
165
- stub_get("/1.1/account/verify_credentials.json").
166
- to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
167
- stub_get("/1.1/lists/show.json").
168
- with(:query => {:owner_screen_name => "sferik", :slug => 'presidents'}).
169
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
170
- stub_post("/1.1/lists/destroy.json").
171
- with(:body => {:owner_id => "7505382", :list_id => "8863586"}).
172
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
137
+ stub_get("/1.1/account/verify_credentials.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
138
+ stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :slug => 'presidents'}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
139
+ stub_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "8863586"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
173
140
  end
174
141
  it "should request the correct resource" do
175
142
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
176
143
  $stdin.should_receive(:gets).and_return("yes")
177
144
  @delete.list("presidents")
178
- a_get("/1.1/account/verify_credentials.json").
179
- should have_been_made
180
- a_post("/1.1/lists/destroy.json").
181
- with(:body => {:owner_id => "7505382", :list_id => "8863586"}).
182
- should have_been_made
145
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
146
+ expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "8863586"})).to have_been_made
183
147
  end
184
148
  context "yes" do
185
149
  it "should have the correct output" do
186
150
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
187
151
  $stdin.should_receive(:gets).and_return("yes")
188
152
  @delete.list("presidents")
189
- $stdout.string.chomp.should == "@testcli deleted the list \"presidents\"."
153
+ expect($stdout.string.chomp).to eq "@testcli deleted the list \"presidents\"."
190
154
  end
191
155
  end
192
156
  context "no" do
@@ -194,7 +158,7 @@ describe T::Delete do
194
158
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
195
159
  $stdin.should_receive(:gets).and_return("no")
196
160
  @delete.list("presidents")
197
- $stdout.string.chomp.should be_empty
161
+ expect($stdout.string.chomp).to be_empty
198
162
  end
199
163
  end
200
164
  context "--force" do
@@ -203,36 +167,26 @@ describe T::Delete do
203
167
  end
204
168
  it "should request the correct resource" do
205
169
  @delete.list("presidents")
206
- a_get("/1.1/account/verify_credentials.json").
207
- should have_been_made
208
- a_post("/1.1/lists/destroy.json").
209
- with(:body => {:owner_id => "7505382", :list_id => "8863586"}).
210
- should have_been_made
170
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
171
+ expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "8863586"})).to have_been_made
211
172
  end
212
173
  it "should have the correct output" do
213
174
  @delete.list("presidents")
214
- $stdout.string.chomp.should == "@testcli deleted the list \"presidents\"."
175
+ expect($stdout.string.chomp).to eq "@testcli deleted the list \"presidents\"."
215
176
  end
216
177
  end
217
178
  context "--id" do
218
179
  before do
219
180
  @delete.options = @delete.options.merge("id" => true)
220
- stub_get("/1.1/lists/show.json").
221
- with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
222
- to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
181
+ stub_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"})
223
182
  end
224
183
  it "should request the correct resource" do
225
184
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete the list \"presidents\"? [y/N] ")
226
185
  $stdin.should_receive(:gets).and_return("yes")
227
186
  @delete.list("8863586")
228
- a_get("/1.1/lists/show.json").
229
- with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"}).
230
- should have_been_made
231
- a_get("/1.1/account/verify_credentials.json").
232
- should have_been_made
233
- a_post("/1.1/lists/destroy.json").
234
- with(:body => {:owner_id => "7505382", :list_id => "8863586"}).
235
- should have_been_made
187
+ expect(a_get("/1.1/lists/show.json").with(:query => {:owner_screen_name => "sferik", :list_id => "8863586"})).to have_been_made
188
+ expect(a_get("/1.1/account/verify_credentials.json")).to have_been_made
189
+ expect(a_post("/1.1/lists/destroy.json").with(:body => {:owner_id => "7505382", :list_id => "8863586"})).to have_been_made
236
190
  end
237
191
  end
238
192
  end
@@ -240,30 +194,22 @@ describe T::Delete do
240
194
  describe "#status" do
241
195
  before do
242
196
  @delete.options = @delete.options.merge("profile" => fixture_path + "/.trc")
243
- stub_get("/1.1/statuses/show/26755176471724032.json").
244
- with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
245
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
246
- stub_post("/1.1/statuses/destroy/26755176471724032.json").
247
- with(:body => {:trim_user => "true"}).
248
- to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
197
+ stub_get("/1.1/statuses/show/26755176471724032.json").with(:query => {:include_my_retweet => "false", :trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
198
+ stub_post("/1.1/statuses/destroy/26755176471724032.json").with(:body => {:trim_user => "true"}).to_return(:body => fixture("status.json"), :headers => {:content_type => "application/json; charset=utf-8"})
249
199
  end
250
200
  it "should request the correct resource" do
251
201
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
252
202
  $stdin.should_receive(:gets).and_return("yes")
253
203
  @delete.status("26755176471724032")
254
- a_get("/1.1/statuses/show/26755176471724032.json").
255
- with(:query => {:include_my_retweet => "false", :trim_user => "true"}).
256
- should have_been_made
257
- a_post("/1.1/statuses/destroy/26755176471724032.json").
258
- with(:body => {:trim_user => "true"}).
259
- should have_been_made
204
+ expect(a_get("/1.1/statuses/show/26755176471724032.json").with(:query => {:include_my_retweet => "false", :trim_user => "true"})).to have_been_made
205
+ expect(a_post("/1.1/statuses/destroy/26755176471724032.json").with(:body => {:trim_user => "true"})).to have_been_made
260
206
  end
261
207
  context "yes" do
262
208
  it "should have the correct output" do
263
209
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
264
210
  $stdin.should_receive(:gets).and_return("yes")
265
211
  @delete.status("26755176471724032")
266
- $stdout.string.chomp.should == "@testcli deleted the Tweet: \"The problem with your code is that it's doing exactly what you told it to do.\""
212
+ expect($stdout.string.chomp).to eq "@testcli deleted the Tweet: \"The problem with your code is that it's doing exactly what you told it to do.\""
267
213
  end
268
214
  end
269
215
  context "no" do
@@ -271,7 +217,7 @@ describe T::Delete do
271
217
  $stdout.should_receive(:print).with("Are you sure you want to permanently delete @sferik's status: \"The problem with your code is that it's doing exactly what you told it to do.\"? [y/N] ")
272
218
  $stdin.should_receive(:gets).and_return("no")
273
219
  @delete.status("26755176471724032")
274
- $stdout.string.chomp.should be_empty
220
+ expect($stdout.string.chomp).to be_empty
275
221
  end
276
222
  end
277
223
  context "--force" do
@@ -280,13 +226,11 @@ describe T::Delete do
280
226
  end
281
227
  it "should request the correct resource" do
282
228
  @delete.status("26755176471724032")
283
- a_post("/1.1/statuses/destroy/26755176471724032.json").
284
- with(:body => {:trim_user => "true"}).
285
- should have_been_made
229
+ expect(a_post("/1.1/statuses/destroy/26755176471724032.json").with(:body => {:trim_user => "true"})).to have_been_made
286
230
  end
287
231
  it "should have the correct output" do
288
232
  @delete.status("26755176471724032")
289
- $stdout.string.chomp.should == "@testcli deleted the Tweet: \"The problem with your code is that it's doing exactly what you told it to do.\""
233
+ expect($stdout.string.chomp).to eq "@testcli deleted the Tweet: \"The problem with your code is that it's doing exactly what you told it to do.\""
290
234
  end
291
235
  end
292
236
  end
data/spec/helper.rb CHANGED
@@ -13,6 +13,12 @@ require 'timecop'
13
13
  require 'webmock/rspec'
14
14
  require 'json'
15
15
 
16
+ RSpec.configure do |config|
17
+ config.expect_with :rspec do |c|
18
+ c.syntax = :expect
19
+ end
20
+ end
21
+
16
22
  def a_delete(path, endpoint='https://api.twitter.com')
17
23
  a_request(:delete, endpoint + path)
18
24
  end