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/README.md +27 -27
- data/lib/t/cli.rb +1 -1
- data/lib/t/version.rb +1 -1
- data/spec/cli_spec.rb +443 -981
- data/spec/delete_spec.rb +43 -99
- data/spec/helper.rb +6 -0
- data/spec/list_spec.rb +69 -151
- data/spec/rcfile_spec.rb +66 -66
- data/spec/search_spec.rb +126 -280
- data/spec/set_spec.rb +28 -52
- data/spec/stream_spec.rb +33 -33
- data/spec/utils_spec.rb +21 -21
- metadata +2 -2
data/spec/set_spec.rb
CHANGED
@@ -24,154 +24,130 @@ describe T::Set do
|
|
24
24
|
end
|
25
25
|
it "should have the correct output" do
|
26
26
|
@set.active("testcli", "abc123")
|
27
|
-
$stdout.string.chomp.
|
27
|
+
expect($stdout.string.chomp).to eq "Active account has been updated to testcli."
|
28
28
|
end
|
29
29
|
it "should accept an account name without a consumer key" do
|
30
30
|
@set.active("testcli")
|
31
|
-
$stdout.string.chomp.
|
31
|
+
expect($stdout.string.chomp).to eq "Active account has been updated to testcli."
|
32
32
|
end
|
33
33
|
it "should be case insensitive" do
|
34
34
|
@set.active("TestCLI", "abc123")
|
35
|
-
$stdout.string.chomp.
|
35
|
+
expect($stdout.string.chomp).to eq "Active account has been updated to testcli."
|
36
36
|
end
|
37
37
|
it "should raise an error if username is ambiguous" do
|
38
|
-
|
38
|
+
expect do
|
39
39
|
@set.active("test", "abc123")
|
40
|
-
end.
|
40
|
+
end.to raise_error(ArgumentError, /Username test is ambiguous/)
|
41
41
|
end
|
42
42
|
it "should raise an error if the username is not found" do
|
43
|
-
|
43
|
+
expect do
|
44
44
|
@set.active("clitest")
|
45
|
-
end.
|
45
|
+
end.to raise_error(ArgumentError, /Username clitest is not found/)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#bio" do
|
50
50
|
before do
|
51
51
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
52
|
-
stub_post("/1.1/account/update_profile.json").
|
53
|
-
with(:body => {:description => "Vagabond."}).
|
54
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
52
|
+
stub_post("/1.1/account/update_profile.json").with(:body => {:description => "Vagabond."}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
55
53
|
end
|
56
54
|
it "should request the correct resource" do
|
57
55
|
@set.bio("Vagabond.")
|
58
|
-
a_post("/1.1/account/update_profile.json").
|
59
|
-
with(:body => {:description => "Vagabond."}).
|
60
|
-
should have_been_made
|
56
|
+
expect(a_post("/1.1/account/update_profile.json").with(:body => {:description => "Vagabond."})).to have_been_made
|
61
57
|
end
|
62
58
|
it "should have the correct output" do
|
63
59
|
@set.bio("Vagabond.")
|
64
|
-
$stdout.string.chomp.
|
60
|
+
expect($stdout.string.chomp).to eq "@testcli's bio has been updated."
|
65
61
|
end
|
66
62
|
end
|
67
63
|
|
68
64
|
describe "#language" do
|
69
65
|
before do
|
70
66
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
71
|
-
stub_post("/1.1/account/settings.json").
|
72
|
-
with(:body => {:lang => "en"}).
|
73
|
-
to_return(:body => fixture("settings.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
67
|
+
stub_post("/1.1/account/settings.json").with(:body => {:lang => "en"}).to_return(:body => fixture("settings.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
74
68
|
end
|
75
69
|
it "should request the correct resource" do
|
76
70
|
@set.language("en")
|
77
|
-
a_post("/1.1/account/settings.json").
|
78
|
-
with(:body => {:lang => "en"}).
|
79
|
-
should have_been_made
|
71
|
+
expect(a_post("/1.1/account/settings.json").with(:body => {:lang => "en"})).to have_been_made
|
80
72
|
end
|
81
73
|
it "should have the correct output" do
|
82
74
|
@set.language("en")
|
83
|
-
$stdout.string.chomp.
|
75
|
+
expect($stdout.string.chomp).to eq "@testcli's language has been updated."
|
84
76
|
end
|
85
77
|
end
|
86
78
|
|
87
79
|
describe "#location" do
|
88
80
|
before do
|
89
81
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
90
|
-
stub_post("/1.1/account/update_profile.json").
|
91
|
-
with(:body => {:location => "San Francisco"}).
|
92
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
82
|
+
stub_post("/1.1/account/update_profile.json").with(:body => {:location => "San Francisco"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
93
83
|
end
|
94
84
|
it "should request the correct resource" do
|
95
85
|
@set.location("San Francisco")
|
96
|
-
a_post("/1.1/account/update_profile.json").
|
97
|
-
with(:body => {:location => "San Francisco"}).
|
98
|
-
should have_been_made
|
86
|
+
expect(a_post("/1.1/account/update_profile.json").with(:body => {:location => "San Francisco"})).to have_been_made
|
99
87
|
end
|
100
88
|
it "should have the correct output" do
|
101
89
|
@set.location("San Francisco")
|
102
|
-
$stdout.string.chomp.
|
90
|
+
expect($stdout.string.chomp).to eq "@testcli's location has been updated."
|
103
91
|
end
|
104
92
|
end
|
105
93
|
|
106
94
|
describe "#name" do
|
107
95
|
before do
|
108
96
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
109
|
-
stub_post("/1.1/account/update_profile.json").
|
110
|
-
with(:body => {:name => "Erik Michaels-Ober"}).
|
111
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
97
|
+
stub_post("/1.1/account/update_profile.json").with(:body => {:name => "Erik Michaels-Ober"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
112
98
|
end
|
113
99
|
it "should request the correct resource" do
|
114
100
|
@set.name("Erik Michaels-Ober")
|
115
|
-
a_post("/1.1/account/update_profile.json").
|
116
|
-
with(:body => {:name => "Erik Michaels-Ober"}).
|
117
|
-
should have_been_made
|
101
|
+
expect(a_post("/1.1/account/update_profile.json").with(:body => {:name => "Erik Michaels-Ober"})).to have_been_made
|
118
102
|
end
|
119
103
|
it "should have the correct output" do
|
120
104
|
@set.name("Erik Michaels-Ober")
|
121
|
-
$stdout.string.chomp.
|
105
|
+
expect($stdout.string.chomp).to eq "@testcli's name has been updated."
|
122
106
|
end
|
123
107
|
end
|
124
108
|
|
125
109
|
describe "#profile_background_image" do
|
126
110
|
before do
|
127
111
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
128
|
-
stub_post("/1.1/account/update_profile_background_image.json").
|
129
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
112
|
+
stub_post("/1.1/account/update_profile_background_image.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
130
113
|
end
|
131
114
|
it "should request the correct resource" do
|
132
115
|
@set.profile_background_image(fixture_path + "/we_concept_bg2.png")
|
133
|
-
a_post("/1.1/account/update_profile_background_image.json").
|
134
|
-
should have_been_made
|
116
|
+
expect(a_post("/1.1/account/update_profile_background_image.json")).to have_been_made
|
135
117
|
end
|
136
118
|
it "should have the correct output" do
|
137
119
|
@set.profile_background_image(fixture_path + "/we_concept_bg2.png")
|
138
|
-
$stdout.string.chomp.
|
120
|
+
expect($stdout.string.chomp).to eq "@testcli's background image has been updated."
|
139
121
|
end
|
140
122
|
end
|
141
123
|
|
142
124
|
describe "#profile_image" do
|
143
125
|
before do
|
144
126
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
145
|
-
stub_post("/1.1/account/update_profile_image.json").
|
146
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
127
|
+
stub_post("/1.1/account/update_profile_image.json").to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
147
128
|
end
|
148
129
|
it "should request the correct resource" do
|
149
130
|
@set.profile_image(fixture_path + "/me.jpg")
|
150
|
-
a_post("/1.1/account/update_profile_image.json").
|
151
|
-
should have_been_made
|
131
|
+
expect(a_post("/1.1/account/update_profile_image.json")).to have_been_made
|
152
132
|
end
|
153
133
|
it "should have the correct output" do
|
154
134
|
@set.profile_image(fixture_path + "/me.jpg")
|
155
|
-
$stdout.string.chomp.
|
135
|
+
expect($stdout.string.chomp).to eq "@testcli's image has been updated."
|
156
136
|
end
|
157
137
|
end
|
158
138
|
|
159
139
|
describe "#url" do
|
160
140
|
before do
|
161
141
|
@set.options = @set.options.merge("profile" => fixture_path + "/.trc")
|
162
|
-
stub_post("/1.1/account/update_profile.json").
|
163
|
-
with(:body => {:url => "https://github.com/sferik"}).
|
164
|
-
to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
142
|
+
stub_post("/1.1/account/update_profile.json").with(:body => {:url => "https://github.com/sferik"}).to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"})
|
165
143
|
end
|
166
144
|
it "should request the correct resource" do
|
167
145
|
@set.url("https://github.com/sferik")
|
168
|
-
a_post("/1.1/account/update_profile.json").
|
169
|
-
with(:body => {:url => "https://github.com/sferik"}).
|
170
|
-
should have_been_made
|
146
|
+
expect(a_post("/1.1/account/update_profile.json").with(:body => {:url => "https://github.com/sferik"})).to have_been_made
|
171
147
|
end
|
172
148
|
it "should have the correct output" do
|
173
149
|
@set.url("https://github.com/sferik")
|
174
|
-
$stdout.string.chomp.
|
150
|
+
expect($stdout.string.chomp).to eq "@testcli's URL has been updated."
|
175
151
|
end
|
176
152
|
end
|
177
153
|
|
data/spec/stream_spec.rb
CHANGED
@@ -25,13 +25,13 @@ describe T::Stream do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
|
-
describe
|
29
|
-
context
|
28
|
+
describe "#all" do
|
29
|
+
context "--csv" do
|
30
30
|
before :each do
|
31
31
|
@stream.options = @stream.options.merge("csv" => true)
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it "outputs headings when the stream initializes" do
|
35
35
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
36
36
|
@tweetstream_client.stub(:on_inited).and_yield
|
37
37
|
|
@@ -49,12 +49,12 @@ describe T::Stream do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
context
|
52
|
+
context "--long" do
|
53
53
|
before :each do
|
54
54
|
@stream.options = @stream.options.merge("long" => true)
|
55
55
|
end
|
56
56
|
|
57
|
-
it
|
57
|
+
it "outputs headings when the stream initializes" do
|
58
58
|
@tweetstream_client.stub(:on_inited).and_yield
|
59
59
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
60
60
|
|
@@ -72,48 +72,48 @@ describe T::Stream do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
context
|
75
|
+
context "normal usage" do
|
76
76
|
before :each do
|
77
77
|
@tweetstream_client.stub(:on_timeline_status).
|
78
78
|
and_yield(@status)
|
79
79
|
end
|
80
80
|
|
81
|
-
it
|
81
|
+
it "prints the tweet status" do
|
82
82
|
@stream.should_receive(:print_message)
|
83
83
|
@stream.all
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
-
it
|
87
|
+
it "invokes TweetStream::Client#sample" do
|
88
88
|
@tweetstream_client.should_receive(:sample)
|
89
89
|
@stream.all
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
describe
|
93
|
+
describe "#matrix" do
|
94
94
|
before :each do
|
95
95
|
@tweetstream_client.stub(:on_timeline_status).
|
96
96
|
and_yield(@status)
|
97
97
|
end
|
98
98
|
|
99
|
-
it
|
99
|
+
it "outputs the tweet status" do
|
100
100
|
@stream.should_receive(:say).with(any_args)
|
101
101
|
@stream.matrix
|
102
102
|
end
|
103
103
|
|
104
|
-
it
|
104
|
+
it "invokes TweetStream::Client.sample" do
|
105
105
|
@tweetstream_client.should_receive(:sample)
|
106
106
|
@stream.matrix
|
107
107
|
end
|
108
108
|
end
|
109
109
|
|
110
|
-
describe
|
110
|
+
describe "#search" do
|
111
111
|
before :each do
|
112
112
|
@tweetstream_client.stub(:on_timeline_status).
|
113
113
|
and_yield(@status)
|
114
114
|
end
|
115
115
|
|
116
|
-
context
|
116
|
+
context "--csv" do
|
117
117
|
before :each do
|
118
118
|
@stream.options = @stream.options.merge("csv" => true)
|
119
119
|
end
|
@@ -126,7 +126,7 @@ describe T::Stream do
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
-
context
|
129
|
+
context "--long" do
|
130
130
|
before :each do
|
131
131
|
@stream.options = @stream.options.merge("long" => true)
|
132
132
|
end
|
@@ -141,19 +141,19 @@ describe T::Stream do
|
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
144
|
-
context
|
144
|
+
context "normal usage" do
|
145
145
|
before :each do
|
146
146
|
@tweetstream_client.stub(:on_timeline_status).
|
147
147
|
and_yield(@status)
|
148
148
|
end
|
149
149
|
|
150
|
-
it
|
150
|
+
it "prints the tweet status" do
|
151
151
|
@stream.should_receive(:print_message)
|
152
152
|
@stream.search('t gem')
|
153
153
|
end
|
154
154
|
end
|
155
155
|
|
156
|
-
it
|
156
|
+
it "performs a REST search when the stream initializes" do
|
157
157
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
158
158
|
@tweetstream_client.stub(:on_inited).and_yield
|
159
159
|
|
@@ -163,7 +163,7 @@ describe T::Stream do
|
|
163
163
|
@stream.search('t', 'gem')
|
164
164
|
end
|
165
165
|
|
166
|
-
it
|
166
|
+
it "invokes TweetStream::Client#track" do
|
167
167
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
168
168
|
|
169
169
|
@tweetstream_client.should_receive(:track).with(['t gem'])
|
@@ -171,13 +171,13 @@ describe T::Stream do
|
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
describe
|
174
|
+
describe "#timeline" do
|
175
175
|
before :each do
|
176
176
|
@tweetstream_client.stub(:on_timeline_status).
|
177
177
|
and_yield(@status)
|
178
178
|
end
|
179
179
|
|
180
|
-
context
|
180
|
+
context "--csv" do
|
181
181
|
before :each do
|
182
182
|
@stream.options = @stream.options.merge("csv" => true)
|
183
183
|
end
|
@@ -190,7 +190,7 @@ describe T::Stream do
|
|
190
190
|
end
|
191
191
|
end
|
192
192
|
|
193
|
-
context
|
193
|
+
context "--long" do
|
194
194
|
before :each do
|
195
195
|
@stream.options = @stream.options.merge("long" => true)
|
196
196
|
end
|
@@ -205,19 +205,19 @@ describe T::Stream do
|
|
205
205
|
end
|
206
206
|
end
|
207
207
|
|
208
|
-
context
|
208
|
+
context "normal usage" do
|
209
209
|
before :each do
|
210
210
|
@tweetstream_client.stub(:on_timeline_status).
|
211
211
|
and_yield(@status)
|
212
212
|
end
|
213
213
|
|
214
|
-
it
|
214
|
+
it "prints the tweet status" do
|
215
215
|
@stream.should_receive(:print_message)
|
216
216
|
@stream.timeline
|
217
217
|
end
|
218
218
|
end
|
219
219
|
|
220
|
-
it
|
220
|
+
it "performs a REST search when the stream initializes" do
|
221
221
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
222
222
|
@tweetstream_client.stub(:on_inited).and_yield
|
223
223
|
|
@@ -227,7 +227,7 @@ describe T::Stream do
|
|
227
227
|
@stream.timeline
|
228
228
|
end
|
229
229
|
|
230
|
-
it
|
230
|
+
it "invokes TweetStream::Client#userstream" do
|
231
231
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
232
232
|
|
233
233
|
@tweetstream_client.should_receive(:userstream)
|
@@ -235,18 +235,18 @@ describe T::Stream do
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
describe
|
238
|
+
describe "#users" do
|
239
239
|
before :each do
|
240
240
|
@tweetstream_client.stub(:on_timeline_status).
|
241
241
|
and_yield(@status)
|
242
242
|
end
|
243
243
|
|
244
|
-
context
|
244
|
+
context "--csv" do
|
245
245
|
before :each do
|
246
246
|
@stream.options = @stream.options.merge("csv" => true)
|
247
247
|
end
|
248
248
|
|
249
|
-
it
|
249
|
+
it "outputs headings when the stream initializes" do
|
250
250
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
251
251
|
@tweetstream_client.stub(:on_inited).and_yield
|
252
252
|
|
@@ -262,12 +262,12 @@ describe T::Stream do
|
|
262
262
|
end
|
263
263
|
end
|
264
264
|
|
265
|
-
context
|
265
|
+
context "--long" do
|
266
266
|
before :each do
|
267
267
|
@stream.options = @stream.options.merge("long" => true)
|
268
268
|
end
|
269
269
|
|
270
|
-
it
|
270
|
+
it "outputs headings when the stream initializes" do
|
271
271
|
@tweetstream_client.stub(:on_inited).and_yield
|
272
272
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
273
273
|
|
@@ -285,19 +285,19 @@ describe T::Stream do
|
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
|
-
context
|
288
|
+
context "normal usage" do
|
289
289
|
before :each do
|
290
290
|
@tweetstream_client.stub(:on_timeline_status).
|
291
291
|
and_yield(@status)
|
292
292
|
end
|
293
293
|
|
294
|
-
it
|
294
|
+
it "prints the tweet status" do
|
295
295
|
@stream.should_receive(:print_message)
|
296
296
|
@stream.users('123')
|
297
297
|
end
|
298
298
|
end
|
299
299
|
|
300
|
-
it
|
300
|
+
it "invokes TweetStream::Client#follow" do
|
301
301
|
@tweetstream_client.stub(:on_timeline_status).and_return
|
302
302
|
|
303
303
|
@tweetstream_client.should_receive(:follow).with([123, 456, 789])
|
data/spec/utils_spec.rb
CHANGED
@@ -21,74 +21,74 @@ describe T::Utils do
|
|
21
21
|
|
22
22
|
describe "#distance_of_time_in_words" do
|
23
23
|
it "returns \"a split second\" if difference is less than a second" do
|
24
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 0))).
|
24
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 0)))).to eq "a split second"
|
25
25
|
end
|
26
26
|
it "returns \"a second\" if difference is a second" do
|
27
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 1))).
|
27
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 1)))).to eq "a second"
|
28
28
|
end
|
29
29
|
it "returns \"2 seconds\" if difference is 2 seconds" do
|
30
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 2))).
|
30
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 2)))).to eq "2 seconds"
|
31
31
|
end
|
32
32
|
it "returns \"59 seconds\" if difference is just shy of 1 minute" do
|
33
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 59.9))).
|
33
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 20, 59.9)))).to eq "59 seconds"
|
34
34
|
end
|
35
35
|
it "returns \"a minute\" if difference is 1 minute" do
|
36
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 21, 0))).
|
36
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 21, 0)))).to eq "a minute"
|
37
37
|
end
|
38
38
|
it "returns \"2 minutes\" if difference is 2 minutes" do
|
39
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 22, 0))).
|
39
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 16, 22, 0)))).to eq "2 minutes"
|
40
40
|
end
|
41
41
|
it "returns \"59 minutes\" if difference is just shy of 1 hour" do
|
42
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 19, 59.9))).
|
42
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 19, 59.9)))).to eq "59 minutes"
|
43
43
|
end
|
44
44
|
it "returns \"an hour\" if difference is 1 hour" do
|
45
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 20, 0))).
|
45
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 17, 20, 0)))).to eq "an hour"
|
46
46
|
end
|
47
47
|
it "returns \"2 hours\" if difference is 2 hours" do
|
48
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 18, 20, 0))).
|
48
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 24, 18, 20, 0)))).to eq "2 hours"
|
49
49
|
end
|
50
50
|
it "returns \"23 hours\" if difference is just shy of 23.5 hours" do
|
51
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 49, 59.9))).
|
51
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 49, 59.9)))).to eq "23 hours"
|
52
52
|
end
|
53
53
|
it "returns \"a day\" if difference is 23.5 hours" do
|
54
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 50, 0))).
|
54
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 25, 15, 50, 0)))).to eq "a day"
|
55
55
|
end
|
56
56
|
it "returns \"2 days\" if difference is 2 days" do
|
57
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 26, 16, 20, 0))).
|
57
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 11, 26, 16, 20, 0)))).to eq "2 days"
|
58
58
|
end
|
59
59
|
it "returns \"29 days\" if difference is just shy of 29.5 days" do
|
60
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 19, 59.9))).
|
60
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 19, 59.9)))).to eq "29 days"
|
61
61
|
end
|
62
62
|
it "returns \"a month\" if difference is 29.5 days" do
|
63
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 20, 0))).
|
63
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2011, 12, 24, 4, 20, 0)))).to eq "a month"
|
64
64
|
end
|
65
65
|
it "returns \"2 months\" if difference is 2 months" do
|
66
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2012, 1, 24, 16, 20, 0))).
|
66
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2012, 1, 24, 16, 20, 0)))).to eq "2 months"
|
67
67
|
end
|
68
68
|
it "returns \"11 months\" if difference is just shy of 11.5 months" do
|
69
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 19, 59.9))).
|
69
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 19, 59.9)))).to eq "11 months"
|
70
70
|
end
|
71
71
|
it "returns \"a year\" if difference is 11.5 months" do
|
72
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 20, 0))).
|
72
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2012, 11, 8, 11, 20, 0)))).to eq "a year"
|
73
73
|
end
|
74
74
|
it "returns \"2 years\" if difference is 2 years" do
|
75
|
-
@test.send(:distance_of_time_in_words, (Time.utc(2013, 11, 24, 16, 20, 0))).
|
75
|
+
expect(@test.send(:distance_of_time_in_words, (Time.utc(2013, 11, 24, 16, 20, 0)))).to eq "2 years"
|
76
76
|
end
|
77
77
|
end
|
78
78
|
|
79
79
|
describe "#strip_tags" do
|
80
80
|
it "returns string sans tags" do
|
81
|
-
@test.send(:strip_tags, '<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>').
|
81
|
+
expect(@test.send(:strip_tags, '<a href="http://twitter.com/#!/download/iphone" rel="nofollow">Twitter for iPhone</a>')).to eq "Twitter for iPhone"
|
82
82
|
end
|
83
83
|
end
|
84
84
|
|
85
85
|
describe "#number_with_delimiter" do
|
86
86
|
it "returns number with delimiter" do
|
87
|
-
@test.send(:number_with_delimiter, 1234567890).
|
87
|
+
expect(@test.send(:number_with_delimiter, 1234567890)).to eq "1,234,567,890"
|
88
88
|
end
|
89
89
|
context "with custom delimiter" do
|
90
90
|
it "returns number with custom delimiter" do
|
91
|
-
@test.send(:number_with_delimiter, 1234567890, ".").
|
91
|
+
expect(@test.send(:number_with_delimiter, 1234567890, ".")).to eq "1.234.567.890"
|
92
92
|
end
|
93
93
|
end
|
94
94
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: t
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: launchy
|