twitter-text 1.14.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,11 +18,11 @@ describe Twitter::HitHighlighter do
18
18
  end
19
19
 
20
20
  it "should default to <em> tags" do
21
- @highlighter.hit_highlight(@original, @hits).should == "Testing this <em>hit</em> highliter"
21
+ expect(@highlighter.hit_highlight(@original, @hits)).to be == "Testing this <em>hit</em> highliter"
22
22
  end
23
23
 
24
24
  it "should allow tag override" do
25
- @highlighter.hit_highlight(@original, @hits, :tag => 'b').should == "Testing this <b>hit</b> highliter"
25
+ expect(@highlighter.hit_highlight(@original, @hits, :tag => 'b')).to be == "Testing this <b>hit</b> highliter"
26
26
  end
27
27
  end
28
28
 
@@ -32,57 +32,57 @@ describe Twitter::HitHighlighter do
32
32
  end
33
33
 
34
34
  it "should return original when no hits are provided" do
35
- @highlighter.hit_highlight(@original).should == @original
35
+ expect(@highlighter.hit_highlight(@original)).to be == @original
36
36
  end
37
37
 
38
38
  it "should highlight one hit" do
39
- @highlighter.hit_highlight(@original, hits = [[5, 9]]).should == "Hey! <em>this</em> is a test tweet"
39
+ expect(@highlighter.hit_highlight(@original, hits = [[5, 9]])).to be == "Hey! <em>this</em> is a test tweet"
40
40
  end
41
41
 
42
42
  it "should highlight two hits" do
43
- @highlighter.hit_highlight(@original, hits = [[5, 9], [15, 19]]).should == "Hey! <em>this</em> is a <em>test</em> tweet"
43
+ expect(@highlighter.hit_highlight(@original, hits = [[5, 9], [15, 19]])).to be == "Hey! <em>this</em> is a <em>test</em> tweet"
44
44
  end
45
45
 
46
46
  it "should correctly highlight first-word hits" do
47
- @highlighter.hit_highlight(@original, hits = [[0, 3]]).should == "<em>Hey</em>! this is a test tweet"
47
+ expect(@highlighter.hit_highlight(@original, hits = [[0, 3]])).to be == "<em>Hey</em>! this is a test tweet"
48
48
  end
49
49
 
50
50
  it "should correctly highlight last-word hits" do
51
- @highlighter.hit_highlight(@original, hits = [[20, 25]]).should == "Hey! this is a test <em>tweet</em>"
51
+ expect(@highlighter.hit_highlight(@original, hits = [[20, 25]])).to be == "Hey! this is a test <em>tweet</em>"
52
52
  end
53
53
  end
54
54
 
55
55
  context "with links" do
56
56
  it "should highlight with a single link" do
57
- @highlighter.hit_highlight("@<a>bcherry</a> this was a test tweet", [[9, 13]]).should == "@<a>bcherry</a> <em>this</em> was a test tweet"
57
+ expect(@highlighter.hit_highlight("@<a>bcherry</a> this was a test tweet", [[9, 13]])).to be == "@<a>bcherry</a> <em>this</em> was a test tweet"
58
58
  end
59
59
 
60
60
  it "should highlight with link at the end" do
61
- @highlighter.hit_highlight("test test <a>test</a>", [[5, 9]]).should == "test <em>test</em> <a>test</a>"
61
+ expect(@highlighter.hit_highlight("test test <a>test</a>", [[5, 9]])).to be == "test <em>test</em> <a>test</a>"
62
62
  end
63
63
 
64
64
  it "should highlight with a link at the beginning" do
65
- @highlighter.hit_highlight("<a>test</a> test test", [[5, 9]]).should == "<a>test</a> <em>test</em> test"
65
+ expect(@highlighter.hit_highlight("<a>test</a> test test", [[5, 9]])).to be == "<a>test</a> <em>test</em> test"
66
66
  end
67
67
 
68
68
  it "should highlight an entire link" do
69
- @highlighter.hit_highlight("test <a>test</a> test", [[5, 9]]).should == "test <a><em>test</em></a> test"
69
+ expect(@highlighter.hit_highlight("test <a>test</a> test", [[5, 9]])).to be == "test <a><em>test</em></a> test"
70
70
  end
71
71
 
72
72
  it "should highlight within a link" do
73
- @highlighter.hit_highlight("test <a>test</a> test", [[6, 8]]).should == "test <a>t<em>es</em>t</a> test"
73
+ expect(@highlighter.hit_highlight("test <a>test</a> test", [[6, 8]])).to be == "test <a>t<em>es</em>t</a> test"
74
74
  end
75
75
 
76
76
  it "should highlight around a link" do
77
- @highlighter.hit_highlight("test <a>test</a> test", [[3, 11]]).should == "tes<em>t <a>test</a> t</em>est"
77
+ expect(@highlighter.hit_highlight("test <a>test</a> test", [[3, 11]])).to be == "tes<em>t <a>test</a> t</em>est"
78
78
  end
79
79
 
80
80
  it "should fail gracefully with bad hits" do
81
- @highlighter.hit_highlight("test test", [[5, 20]]).should == "test <em>test</em>"
81
+ expect(@highlighter.hit_highlight("test test", [[5, 20]])).to be == "test <em>test</em>"
82
82
  end
83
83
 
84
84
  it "should not mess up with touching tags" do
85
- @highlighter.hit_highlight("<a>foo</a><a>foo</a>", [[3,6]]).should == "<a>foo</a><a><em>foo</em></a>"
85
+ expect(@highlighter.hit_highlight("<a>foo</a><a>foo</a>", [[3,6]])).to be == "<a>foo</a><a><em>foo</em></a>"
86
86
  end
87
87
 
88
88
  end
@@ -5,33 +5,33 @@ describe "Twitter::Regex regular expressions" do
5
5
  describe "matching URLS" do
6
6
  TestUrls::VALID.each do |url|
7
7
  it "should match the URL #{url}" do
8
- url.should match_autolink_expression
8
+ expect(url).to match_autolink_expression
9
9
  end
10
10
 
11
11
  it "should match the URL #{url} when it's embedded in other text" do
12
12
  text = "Sweet url: #{url} I found. #awesome"
13
- url.should match_autolink_expression_in(text)
13
+ expect(url).to match_autolink_expression_in(text)
14
14
  end
15
15
  end
16
16
  end
17
17
 
18
18
  describe "invalid URLS" do
19
19
  it "does not link urls with invalid characters" do
20
- TestUrls::INVALID.each {|url| url.should_not match_autolink_expression}
20
+ TestUrls::INVALID.each {|url| expect(url).to_not match_autolink_expression}
21
21
  end
22
22
  end
23
23
 
24
24
  describe "matching List names" do
25
25
  it "should match if less than 25 characters" do
26
26
  name = "Shuffleboard Community"
27
- name.length.should < 25
28
- name.should match(Twitter::Regex::REGEXEN[:list_name])
27
+ expect(name.length).to be < 25
28
+ expect(name).to match(Twitter::Regex::REGEXEN[:list_name])
29
29
  end
30
30
 
31
31
  it "should not match if greater than 25 characters" do
32
32
  name = "Most Glorious Shady Meadows Shuffleboard Community"
33
- name.length.should > 25
34
- name.should match(Twitter::Regex[:list_name])
33
+ expect(name.length).to be > 25
34
+ expect(name).to match(Twitter::Regex[:list_name])
35
35
  end
36
36
 
37
37
  end
@@ -26,8 +26,8 @@ describe Twitter::Rewriter do
26
26
  def original_text; "hello @jacob"; end
27
27
 
28
28
  it "should be rewritten" do
29
- @block_args.should == ["@", "jacob", nil]
30
- @rewritten_text.should == "hello [rewritten]"
29
+ expect(@block_args).to be == ["@", "jacob", nil]
30
+ expect(@rewritten_text).to be == "hello [rewritten]"
31
31
  end
32
32
  end
33
33
 
@@ -35,8 +35,8 @@ describe Twitter::Rewriter do
35
35
  def original_text; "@jacob you're cool"; end
36
36
 
37
37
  it "should be rewritten" do
38
- @block_args.should == ["@", "jacob", nil]
39
- @rewritten_text.should == "[rewritten] you're cool"
38
+ expect(@block_args).to be == ["@", "jacob", nil]
39
+ expect(@rewritten_text).to be == "[rewritten] you're cool"
40
40
  end
41
41
  end
42
42
 
@@ -44,8 +44,8 @@ describe Twitter::Rewriter do
44
44
  def original_text; "meet@the beach"; end
45
45
 
46
46
  it "should not be rewritten" do
47
- @block_args.should be_nil
48
- @rewritten_text.should == "meet@the beach"
47
+ expect(@block_args).to be nil
48
+ expect(@rewritten_text).to be == "meet@the beach"
49
49
  end
50
50
  end
51
51
 
@@ -53,8 +53,8 @@ describe Twitter::Rewriter do
53
53
  def original_text; "great.@jacob"; end
54
54
 
55
55
  it "should be rewritten" do
56
- @block_args.should == ["@", "jacob", nil]
57
- @rewritten_text.should == "great.[rewritten]"
56
+ expect(@block_args).to be == ["@", "jacob", nil]
57
+ expect(@rewritten_text).to be == "great.[rewritten]"
58
58
  end
59
59
  end
60
60
 
@@ -62,8 +62,8 @@ describe Twitter::Rewriter do
62
62
  def original_text; "@jacob&^$%^"; end
63
63
 
64
64
  it "should be rewritten" do
65
- @block_args.should == ["@", "jacob", nil]
66
- @rewritten_text.should == "[rewritten]&^$%^"
65
+ expect(@block_args).to be == ["@", "jacob", nil]
66
+ expect(@rewritten_text).to be == "[rewritten]&^$%^"
67
67
  end
68
68
  end
69
69
 
@@ -74,8 +74,8 @@ describe Twitter::Rewriter do
74
74
  end
75
75
 
76
76
  it "should be rewritten" do
77
- @block_args.should == ["@", @twenty_character_username, nil]
78
- @rewritten_text.should == "[rewritten]1"
77
+ expect(@block_args).to be == ["@", @twenty_character_username, nil]
78
+ expect(@rewritten_text).to be == "[rewritten]1"
79
79
  end
80
80
  end
81
81
 
@@ -83,8 +83,8 @@ describe Twitter::Rewriter do
83
83
  def original_text; "@jacobの"; end
84
84
 
85
85
  it "should be rewritten" do
86
- @block_args.should == ["@", "jacob", nil]
87
- @rewritten_text.should == "[rewritten]の"
86
+ expect(@block_args).to be == ["@", "jacob", nil]
87
+ expect(@rewritten_text).to be == "[rewritten]の"
88
88
  end
89
89
  end
90
90
 
@@ -92,8 +92,8 @@ describe Twitter::Rewriter do
92
92
  def original_text; "あ@jacob"; end
93
93
 
94
94
  it "should be rewritten" do
95
- @block_args.should == ["@", "jacob", nil]
96
- @rewritten_text.should == "あ[rewritten]"
95
+ expect(@block_args).to be == ["@", "jacob", nil]
96
+ expect(@rewritten_text).to be == "あ[rewritten]"
97
97
  end
98
98
  end
99
99
 
@@ -101,8 +101,8 @@ describe Twitter::Rewriter do
101
101
  def original_text; "あ@jacobの"; end
102
102
 
103
103
  it "should be rewritten" do
104
- @block_args.should == ["@", "jacob", nil]
105
- @rewritten_text.should == "あ[rewritten]の"
104
+ expect(@block_args).to be == ["@", "jacob", nil]
105
+ expect(@rewritten_text).to be == "あ[rewritten]の"
106
106
  end
107
107
  end
108
108
 
@@ -112,8 +112,8 @@ describe Twitter::Rewriter do
112
112
  end
113
113
 
114
114
  it "should be rewritten" do
115
- @block_args.should == ["@", "jacob", nil]
116
- @rewritten_text.should == "[rewritten]"
115
+ expect(@block_args).to be == ["@", "jacob", nil]
116
+ expect(@rewritten_text).to be == "[rewritten]"
117
117
  end
118
118
  end
119
119
  end #}}}
@@ -127,8 +127,8 @@ describe Twitter::Rewriter do
127
127
  def original_text; "hello @jacob/my-list"; end
128
128
 
129
129
  it "should be rewritten" do
130
- @block_args.should == ["@", "jacob", "/my-list"]
131
- @rewritten_text.should == "hello [rewritten]"
130
+ expect(@block_args).to be == ["@", "jacob", "/my-list"]
131
+ expect(@rewritten_text).to be == "hello [rewritten]"
132
132
  end
133
133
  end
134
134
 
@@ -136,8 +136,8 @@ describe Twitter::Rewriter do
136
136
  def original_text; "hello @jacob/ my-list"; end
137
137
 
138
138
  it "should not be rewritten" do
139
- @block_args.should == ["@", "jacob", nil]
140
- @rewritten_text.should == "hello [rewritten]/ my-list"
139
+ expect(@block_args).to be == ["@", "jacob", nil]
140
+ expect(@rewritten_text).to be == "hello [rewritten]/ my-list"
141
141
  end
142
142
  end
143
143
 
@@ -145,8 +145,8 @@ describe Twitter::Rewriter do
145
145
  def original_text; "hello @/my-list"; end
146
146
 
147
147
  it "should not be rewritten" do
148
- @block_args.should be_nil
149
- @rewritten_text.should == "hello @/my-list"
148
+ expect(@block_args).to be nil
149
+ expect(@rewritten_text).to be == "hello @/my-list"
150
150
  end
151
151
  end
152
152
 
@@ -154,8 +154,8 @@ describe Twitter::Rewriter do
154
154
  def original_text; "@jacob/my-list"; end
155
155
 
156
156
  it "should be rewritten" do
157
- @block_args.should == ["@", "jacob", "/my-list"]
158
- @rewritten_text.should == "[rewritten]"
157
+ expect(@block_args).to be == ["@", "jacob", "/my-list"]
158
+ expect(@rewritten_text).to be == "[rewritten]"
159
159
  end
160
160
  end
161
161
 
@@ -163,8 +163,8 @@ describe Twitter::Rewriter do
163
163
  def original_text; "meet@jacob/my-list"; end
164
164
 
165
165
  it "should not be rewritten" do
166
- @block_args.should be_nil
167
- @rewritten_text.should == "meet@jacob/my-list"
166
+ expect(@block_args).to be nil
167
+ expect(@rewritten_text).to be == "meet@jacob/my-list"
168
168
  end
169
169
  end
170
170
 
@@ -172,8 +172,8 @@ describe Twitter::Rewriter do
172
172
  def original_text; "great.@jacob/my-list"; end
173
173
 
174
174
  it "should be rewritten" do
175
- @block_args.should == ["@", "jacob", "/my-list"]
176
- @rewritten_text.should == "great.[rewritten]"
175
+ expect(@block_args).to be == ["@", "jacob", "/my-list"]
176
+ expect(@rewritten_text).to be == "great.[rewritten]"
177
177
  end
178
178
  end
179
179
 
@@ -181,8 +181,8 @@ describe Twitter::Rewriter do
181
181
  def original_text; "@jacob/my-list&^$%^"; end
182
182
 
183
183
  it "should be rewritten" do
184
- @block_args.should == ["@", "jacob", "/my-list"]
185
- @rewritten_text.should == "[rewritten]&^$%^"
184
+ expect(@block_args).to be == ["@", "jacob", "/my-list"]
185
+ expect(@rewritten_text).to be == "[rewritten]&^$%^"
186
186
  end
187
187
  end
188
188
 
@@ -193,8 +193,8 @@ describe Twitter::Rewriter do
193
193
  end
194
194
 
195
195
  it "should be rewritten" do
196
- @block_args.should == ["@", "jacob", "/#{@twentyfive_character_list}"]
197
- @rewritten_text.should == "[rewritten]12345"
196
+ expect(@block_args).to be == ["@", "jacob", "/#{@twentyfive_character_list}"]
197
+ expect(@rewritten_text).to be == "[rewritten]12345"
198
198
  end
199
199
  end
200
200
  end #}}}
@@ -208,8 +208,8 @@ describe Twitter::Rewriter do
208
208
  def original_text; "#123"; end
209
209
 
210
210
  it "should not be rewritten" do
211
- @block_args.should be_nil
212
- @rewritten_text.should == "#123"
211
+ expect(@block_args).to be nil
212
+ expect(@rewritten_text).to be == "#123"
213
213
  end
214
214
  end
215
215
 
@@ -217,8 +217,8 @@ describe Twitter::Rewriter do
217
217
  def original_text; "#ab1d"; end
218
218
 
219
219
  it "should be rewritten" do
220
- @block_args.should == ["#", "ab1d"]
221
- @rewritten_text.should == "[rewritten]"
220
+ expect(@block_args).to be == ["#", "ab1d"]
221
+ expect(@rewritten_text).to be == "[rewritten]"
222
222
  end
223
223
  end
224
224
 
@@ -226,8 +226,8 @@ describe Twitter::Rewriter do
226
226
  def original_text; "#a_b_c_d"; end
227
227
 
228
228
  it "should be rewritten" do
229
- @block_args.should == ["#", "a_b_c_d"]
230
- @rewritten_text.should == "[rewritten]"
229
+ expect(@block_args).to be == ["#", "a_b_c_d"]
230
+ expect(@rewritten_text).to be == "[rewritten]"
231
231
  end
232
232
  end
233
233
 
@@ -235,8 +235,8 @@ describe Twitter::Rewriter do
235
235
  def original_text; "ab#cd"; end
236
236
 
237
237
  it "should not be rewritten" do
238
- @block_args.should be_nil
239
- @rewritten_text.should == "ab#cd"
238
+ expect(@block_args).to be nil
239
+ expect(@rewritten_text).to be == "ab#cd"
240
240
  end
241
241
  end
242
242
 
@@ -244,8 +244,8 @@ describe Twitter::Rewriter do
244
244
  def original_text; "#2ab"; end
245
245
 
246
246
  it "should be rewritten" do
247
- @block_args.should == ["#", "2ab"]
248
- @rewritten_text.should == "[rewritten]"
247
+ expect(@block_args).to be == ["#", "2ab"]
248
+ expect(@rewritten_text).to be == "[rewritten]"
249
249
  end
250
250
  end
251
251
 
@@ -253,8 +253,8 @@ describe Twitter::Rewriter do
253
253
  def original_text; "I'm frickin' awesome #ab #cd #ef"; end
254
254
 
255
255
  it "rewrites each hashtag" do
256
- @block_args.should == [["#", "ab"], ["#", "cd"], ["#", "ef"]]
257
- @rewritten_text.should == "I'm frickin' awesome [rewritten] [rewritten] [rewritten]"
256
+ expect(@block_args).to be == [["#", "ab"], ["#", "cd"], ["#", "ef"]]
257
+ expect(@rewritten_text).to be == "I'm frickin' awesome [rewritten] [rewritten] [rewritten]"
258
258
  end
259
259
  end
260
260
 
@@ -262,8 +262,8 @@ describe Twitter::Rewriter do
262
262
  def original_text; "ok, great.#abc"; end
263
263
 
264
264
  it "should be rewritten" do
265
- @block_args.should == ["#", "abc"]
266
- @rewritten_text.should == "ok, great.[rewritten]"
265
+ expect(@block_args).to be == ["#", "abc"]
266
+ expect(@rewritten_text).to be == "ok, great.[rewritten]"
267
267
  end
268
268
  end
269
269
 
@@ -271,8 +271,8 @@ describe Twitter::Rewriter do
271
271
  def original_text; "&#nbsp;"; end
272
272
 
273
273
  it "should not be rewritten" do
274
- @block_args.should be_nil
275
- @rewritten_text.should == "&#nbsp;"
274
+ expect(@block_args).to be nil
275
+ expect(@rewritten_text).to be == "&#nbsp;"
276
276
  end
277
277
  end
278
278
 
@@ -280,8 +280,8 @@ describe Twitter::Rewriter do
280
280
  def original_text; "#great!"; end
281
281
 
282
282
  it "should be rewritten, but should not include the !" do
283
- @block_args.should == ["#", "great"];
284
- @rewritten_text.should == "[rewritten]!"
283
+ expect(@block_args).to be == ["#", "great"];
284
+ expect(@rewritten_text).to be == "[rewritten]!"
285
285
  end
286
286
  end
287
287
 
@@ -289,8 +289,8 @@ describe Twitter::Rewriter do
289
289
  def original_text; "#twj_devの"; end
290
290
 
291
291
  it "should be rewritten" do
292
- @block_args.should == ["#", "twj_devの"];
293
- @rewritten_text.should == "[rewritten]"
292
+ expect(@block_args).to be == ["#", "twj_devの"];
293
+ expect(@rewritten_text).to be == "[rewritten]"
294
294
  end
295
295
  end
296
296
 
@@ -298,8 +298,8 @@ describe Twitter::Rewriter do
298
298
  def original_text; "#{[0x3000].pack('U')}#twj_dev"; end
299
299
 
300
300
  it "should be rewritten" do
301
- @block_args.should == ["#", "twj_dev"];
302
- @rewritten_text.should == " [rewritten]"
301
+ expect(@block_args).to be == ["#", "twj_dev"];
302
+ expect(@rewritten_text).to be == " [rewritten]"
303
303
  end
304
304
  end
305
305
 
@@ -307,8 +307,8 @@ describe Twitter::Rewriter do
307
307
  def original_text; "#twj_dev#{[0x3000].pack('U')}"; end
308
308
 
309
309
  it "should be rewritten" do
310
- @block_args.should == ["#", "twj_dev"];
311
- @rewritten_text.should == "[rewritten] "
310
+ expect(@block_args).to be == ["#", "twj_dev"];
311
+ expect(@rewritten_text).to be == "[rewritten] "
312
312
  end
313
313
  end
314
314
 
@@ -316,8 +316,8 @@ describe Twitter::Rewriter do
316
316
  def original_text; "#{[0xFF03].pack('U')}twj_dev"; end
317
317
 
318
318
  it "should be rewritten" do
319
- @block_args.should == ["#", "twj_dev"];
320
- @rewritten_text.should == "[rewritten]"
319
+ expect(@block_args).to be == ["#", "twj_dev"];
320
+ expect(@rewritten_text).to be == "[rewritten]"
321
321
  end
322
322
  end
323
323
 
@@ -328,8 +328,8 @@ describe Twitter::Rewriter do
328
328
  end
329
329
 
330
330
  it "should be rewritten" do
331
- @block_args.should == ["#", "éhashtag"];
332
- @rewritten_text.should == "[rewritten]"
331
+ expect(@block_args).to be == ["#", "éhashtag"];
332
+ expect(@rewritten_text).to be == "[rewritten]"
333
333
  end
334
334
  end
335
335
  end #}}}
@@ -345,8 +345,8 @@ describe Twitter::Rewriter do
345
345
  def original_text; "On my search engine #{url} I found good links."; end
346
346
 
347
347
  it "should be rewritten" do
348
- @block_args.should == [url];
349
- @rewritten_text.should == "On my search engine [rewritten] I found good links."
348
+ expect(@block_args).to be == [url];
349
+ expect(@rewritten_text).to be == "On my search engine [rewritten] I found good links."
350
350
  end
351
351
  end
352
352
 
@@ -354,8 +354,8 @@ describe Twitter::Rewriter do
354
354
  def original_text; "いまなにしてる#{url}いまなにしてる"; end
355
355
 
356
356
  it "should be rewritten" do
357
- @block_args.should == [url];
358
- @rewritten_text.should == "いまなにしてる[rewritten]いまなにしてる"
357
+ expect(@block_args).to be == [url];
358
+ expect(@rewritten_text).to be == "いまなにしてる[rewritten]いまなにしてる"
359
359
  end
360
360
  end
361
361
 
@@ -363,16 +363,16 @@ describe Twitter::Rewriter do
363
363
  def original_text; "I found a neatness (#{url})"; end
364
364
 
365
365
  it "should be rewritten" do
366
- @block_args.should == [url];
367
- @rewritten_text.should == "I found a neatness ([rewritten])"
366
+ expect(@block_args).to be == [url];
367
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
368
368
  end
369
369
 
370
370
  context "when the URL ends with a slash;" do
371
371
  def url; "http://www.google.com/"; end
372
372
 
373
373
  it "should be rewritten" do
374
- @block_args.should == [url];
375
- @rewritten_text.should == "I found a neatness ([rewritten])"
374
+ expect(@block_args).to be == [url];
375
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
376
376
  end
377
377
  end
378
378
 
@@ -380,8 +380,8 @@ describe Twitter::Rewriter do
380
380
  def url; "http://www.google.com/fsdfasdf"; end
381
381
 
382
382
  it "should be rewritten" do
383
- @block_args.should == [url];
384
- @rewritten_text.should == "I found a neatness ([rewritten])"
383
+ expect(@block_args).to be == [url];
384
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
385
385
  end
386
386
  end
387
387
  end
@@ -390,16 +390,16 @@ describe Twitter::Rewriter do
390
390
  def original_text; "I found a neatness (#{url})"; end
391
391
 
392
392
  it "should be rewritten" do
393
- @block_args.should == [url];
394
- @rewritten_text.should == "I found a neatness ([rewritten])"
393
+ expect(@block_args).to be == [url];
394
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
395
395
  end
396
396
 
397
397
  context "wikipedia" do
398
398
  def url; "http://en.wikipedia.org/wiki/Madonna_(artist)"; end
399
399
 
400
400
  it "should be rewritten" do
401
- @block_args.should == [url];
402
- @rewritten_text.should == "I found a neatness ([rewritten])"
401
+ expect(@block_args).to be == [url];
402
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
403
403
  end
404
404
  end
405
405
 
@@ -407,8 +407,8 @@ describe Twitter::Rewriter do
407
407
  def url; "http://msdn.com/S(deadbeef)/page.htm"; end
408
408
 
409
409
  it "should be rewritten" do
410
- @block_args.should == [url];
411
- @rewritten_text.should == "I found a neatness ([rewritten])"
410
+ expect(@block_args).to be == [url];
411
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten])"
412
412
  end
413
413
  end
414
414
 
@@ -416,8 +416,8 @@ describe Twitter::Rewriter do
416
416
  def url; "http://example.com/i_has_a_("; end
417
417
 
418
418
  it "should be rewritten" do
419
- @block_args.should == ["http://example.com/i_has_a_"];
420
- @rewritten_text.should == "I found a neatness ([rewritten]()"
419
+ expect(@block_args).to be == ["http://example.com/i_has_a_"];
420
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten]()"
421
421
  end
422
422
  end
423
423
 
@@ -425,8 +425,8 @@ describe Twitter::Rewriter do
425
425
  def url; "http://foo.bar.com/foo_(\")_bar" end
426
426
 
427
427
  it "should be rewritten" do
428
- @block_args.should == ["http://foo.bar.com/foo_"];
429
- @rewritten_text.should == "I found a neatness ([rewritten](\")_bar)"
428
+ expect(@block_args).to be == ["http://foo.bar.com/foo_"];
429
+ expect(@rewritten_text).to be == "I found a neatness ([rewritten](\")_bar)"
430
430
  end
431
431
  end
432
432
 
@@ -434,8 +434,8 @@ describe Twitter::Rewriter do
434
434
  def url; 'http://x.xx.com/("style="color:red"onmouseover="alert(1)' end
435
435
 
436
436
  it "should be rewritten" do
437
- @block_args.should == ["http://x.xx.com/"];
438
- @rewritten_text.should == 'I found a neatness ([rewritten]("style="color:red"onmouseover="alert(1))'
437
+ expect(@block_args).to be == ["http://x.xx.com/"];
438
+ expect(@rewritten_text).to be == 'I found a neatness ([rewritten]("style="color:red"onmouseover="alert(1))'
439
439
  end
440
440
  end
441
441
  end
@@ -444,17 +444,18 @@ describe Twitter::Rewriter do
444
444
  def original_text; "Check this out @hoverbird:#{url}"; end
445
445
 
446
446
  it "should be rewritten" do
447
- @block_args.should == [url];
448
- @rewritten_text.should == "Check this out @hoverbird:[rewritten]"
447
+ expect(@block_args).to be == [url];
448
+ expect(@rewritten_text).to be == "Check this out @hoverbird:[rewritten]"
449
449
  end
450
450
  end
451
451
 
452
452
  context "with a URL ending in allowed punctuation" do
453
453
  it "does not consume ending punctuation" do
454
454
  %w| ? ! , . : ; ] ) } = \ ' |.each do |char|
455
- Twitter::Rewriter.rewrite_urls("#{url}#{char}") do |url|
456
- url.should == url; "[rewritten]"
457
- end.should == "[rewritten]#{char}"
455
+ expect(Twitter::Rewriter.rewrite_urls("#{url}#{char}") do |url|
456
+ expect(url).to be == url
457
+ "[rewritten]"
458
+ end).to be == "[rewritten]#{char}"
458
459
  end
459
460
  end
460
461
  end
@@ -462,9 +463,9 @@ describe Twitter::Rewriter do
462
463
  context "with a URL preceded in forbidden characters" do
463
464
  it "should be rewritten" do
464
465
  %w| \ ' / ! = |.each do |char|
465
- Twitter::Rewriter.rewrite_urls("#{char}#{url}") do |url|
466
+ expect(Twitter::Rewriter.rewrite_urls("#{char}#{url}") do |url|
466
467
  "[rewritten]" # should not be called here.
467
- end.should == "#{char}[rewritten]"
468
+ end).to be == "#{char}[rewritten]"
468
469
  end
469
470
  end
470
471
  end
@@ -473,8 +474,8 @@ describe Twitter::Rewriter do
473
474
  def original_text; "<link rel='true'>#{url}</link>"; end
474
475
 
475
476
  it "should be rewritten" do
476
- @block_args.should == [url];
477
- @rewritten_text.should == "<link rel='true'>[rewritten]</link>"
477
+ expect(@block_args).to be == [url];
478
+ expect(@rewritten_text).to be == "<link rel='true'>[rewritten]</link>"
478
479
  end
479
480
  end
480
481
 
@@ -482,8 +483,8 @@ describe Twitter::Rewriter do
482
483
  def original_text; "http://www.links.org link at start of page, link at end http://www.foo.org"; end
483
484
 
484
485
  it "should autolink each one" do
485
- @block_args.should == [["http://www.links.org"], ["http://www.foo.org"]];
486
- @rewritten_text.should == "[rewritten] link at start of page, link at end [rewritten]"
486
+ expect(@block_args).to be == [["http://www.links.org"], ["http://www.foo.org"]];
487
+ expect(@rewritten_text).to be == "[rewritten] link at start of page, link at end [rewritten]"
487
488
  end
488
489
  end
489
490
 
@@ -491,8 +492,8 @@ describe Twitter::Rewriter do
491
492
  def original_text; "http://foo.com https://bar.com http://mail.foobar.org"; end
492
493
 
493
494
  it "should autolink each one, in the proper order" do
494
- @block_args.should == [["http://foo.com"], ["https://bar.com"], ["http://mail.foobar.org"]];
495
- @rewritten_text.should == "[rewritten] [rewritten] [rewritten]"
495
+ expect(@block_args).to be == [["http://foo.com"], ["https://bar.com"], ["http://mail.foobar.org"]];
496
+ expect(@rewritten_text).to be == "[rewritten] [rewritten] [rewritten]"
496
497
  end
497
498
  end
498
499
 
@@ -500,8 +501,8 @@ describe Twitter::Rewriter do
500
501
  def original_text; "Yahoo integriert Facebook http://golem.mobi/0912/71607.html"; end
501
502
 
502
503
  it "should autolink it" do
503
- @block_args.should == ["http://golem.mobi/0912/71607.html"]
504
- @rewritten_text.should == "Yahoo integriert Facebook [rewritten]"
504
+ expect(@block_args).to be == ["http://golem.mobi/0912/71607.html"]
505
+ expect(@rewritten_text).to be == "Yahoo integriert Facebook [rewritten]"
505
506
  end
506
507
  end
507
508
 
@@ -509,8 +510,8 @@ describe Twitter::Rewriter do
509
510
  def original_text; "I like www.foobar.com dudes"; end
510
511
 
511
512
  it "does not link at all" do
512
- @block_args.should be_nil
513
- @rewritten_text.should == "I like www.foobar.com dudes"
513
+ expect(@block_args).to be nil
514
+ expect(@rewritten_text).to be == "I like www.foobar.com dudes"
514
515
  end
515
516
  end
516
517
 
@@ -519,8 +520,8 @@ describe Twitter::Rewriter do
519
520
  def original_text; 'http://x.xx.com/@"style="color:pink"onmouseover=alert(1)//'; end
520
521
 
521
522
  it "should not allow XSS follwing @" do
522
- @block_args.should == ["http://x.xx.com/"]
523
- @rewritten_text.should == '[rewritten]@"style="color:pink"onmouseover=alert(1)//'
523
+ expect(@block_args).to be == ["http://x.xx.com/"]
524
+ expect(@rewritten_text).to be == '[rewritten]@"style="color:pink"onmouseover=alert(1)//'
524
525
  end
525
526
  end
526
527
 
@@ -528,8 +529,8 @@ describe Twitter::Rewriter do
528
529
  def original_text; "http://example.com/@foobar"; end
529
530
 
530
531
  it "should link url" do
531
- @block_args.should == ["http://example.com/@foobar"]
532
- @rewritten_text.should == "[rewritten]"
532
+ expect(@block_args).to be == ["http://example.com/@foobar"]
533
+ expect(@rewritten_text).to be == "[rewritten]"
533
534
  end
534
535
  end
535
536
 
@@ -537,8 +538,8 @@ describe Twitter::Rewriter do
537
538
  def original_text; "http://example.com/@foobar/"; end
538
539
 
539
540
  it "should not link the username but link full url" do
540
- @block_args.should == ["http://example.com/@foobar/"]
541
- @rewritten_text.should == "[rewritten]"
541
+ expect(@block_args).to be == ["http://example.com/@foobar/"]
542
+ expect(@rewritten_text).to be == "[rewritten]"
542
543
  end
543
544
  end
544
545
  end