Ruby4Skype 0.2.3 → 0.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/LICENSE +3 -0
- data/README +14 -0
- data/Rakefile +67 -0
- data/lib/skypeapi.rb +570 -509
- data/lib/skypeapi/application.rb +79 -77
- data/lib/skypeapi/call.rb +243 -230
- data/lib/skypeapi/chat.rb +162 -172
- data/lib/skypeapi/chatmember.rb +26 -28
- data/lib/skypeapi/chatmessage.rb +81 -65
- data/lib/skypeapi/error.rb +8 -0
- data/lib/skypeapi/event.rb +25 -26
- data/lib/skypeapi/filetransfer.rb +47 -28
- data/lib/skypeapi/group.rb +72 -73
- data/lib/skypeapi/menuitem.rb +44 -44
- data/lib/skypeapi/message.rb +39 -41
- data/lib/skypeapi/object.rb +246 -82
- data/lib/skypeapi/os/etc.rb +48 -98
- data/lib/skypeapi/os/mac.rb +92 -4
- data/lib/skypeapi/os/notifier.rb +31 -0
- data/lib/skypeapi/os/window_event_queue.rb +198 -0
- data/lib/skypeapi/os/window_messagehandler.rb +120 -0
- data/lib/skypeapi/os/windows.rb +170 -306
- data/lib/skypeapi/profile.rb +190 -120
- data/lib/skypeapi/sharefunctions.rb +31 -23
- data/lib/skypeapi/sms.rb +87 -67
- data/lib/skypeapi/user.rb +159 -99
- data/lib/skypeapi/version.rb +3 -3
- data/lib/skypeapi/voicemail.rb +59 -52
- data/spec/matcher_be_boolean.rb +10 -0
- data/spec/skypeapi/application_spec.rb +76 -0
- data/spec/skypeapi/chat_spec.rb +356 -0
- data/spec/skypeapi/chatmember_spec.rb +42 -0
- data/spec/skypeapi/chatmessage_spec.rb +89 -0
- data/spec/skypeapi/event_spec.rb +31 -0
- data/spec/skypeapi/filetransfer_spec.rb +67 -0
- data/spec/skypeapi/group_spec.rb +16 -0
- data/spec/skypeapi/menuitem_spec.rb +37 -0
- data/spec/skypeapi/os/windows_spec.rb +305 -0
- data/spec/skypeapi/profile_spec.rb +22 -0
- data/spec/skypeapi/user_spec.rb +25 -0
- data/spec/skypeapi_spec.rb +528 -0
- metadata +32 -12
- data/lib/skypeapi/os/timer.rb +0 -108
@@ -0,0 +1,356 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
require 'skypeapi'
|
5
|
+
|
6
|
+
Thread.abort_on_exception = true
|
7
|
+
|
8
|
+
describe SkypeAPI::Chat do
|
9
|
+
before :all do
|
10
|
+
SkypeAPI.init
|
11
|
+
SkypeAPI.start_messageloop
|
12
|
+
SkypeAPI.attach_wait
|
13
|
+
end
|
14
|
+
|
15
|
+
after(:all) do
|
16
|
+
SkypeAPI.close
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'notify' do
|
20
|
+
before do
|
21
|
+
@f = false
|
22
|
+
SkypeAPI::ChatMessage.set_notify :status, 'RECEIVED' do |c|
|
23
|
+
@f = true
|
24
|
+
end
|
25
|
+
SkypeAPI::Chat.create('echo123').send_message('hoge')
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should" do
|
29
|
+
begin
|
30
|
+
timeout(10){sleep 1 until @f}
|
31
|
+
rescue Timeout::Error
|
32
|
+
violated
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '1on1' do
|
38
|
+
before(:each) do
|
39
|
+
@chat = SkypeAPI::Chat.create 'echo123'#, 'hogehoge_002'
|
40
|
+
end
|
41
|
+
|
42
|
+
after(:each) do
|
43
|
+
#@chat.leave unless @chat.nil?
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
it "SkypeAPI::Chat.create(string) should be instance of Chat" do
|
48
|
+
SkypeAPI::Chat.create('echo123').should be_instance_of SkypeAPI::Chat
|
49
|
+
end
|
50
|
+
|
51
|
+
it "SkypeAPI::Chat.create(SkypeAPI::User) should be instance of Chat" do
|
52
|
+
SkypeAPI::Chat.create(SkypeAPI.user('echo123')).should be_instance_of SkypeAPI::Chat
|
53
|
+
end
|
54
|
+
|
55
|
+
it "SkypeAPI::Chat.findUsingBlob(@chat.get_blob) should raise error SkypeAPI::Error::API" do
|
56
|
+
lambda{SkypeAPI::Chat.findUsingBlob(@chat.get_blob)}.should raise_error SkypeAPI::Error::API
|
57
|
+
#ERROR 610 CHAT: FINDUSINGBLOB: No existing chat for given blob found or invalid blob
|
58
|
+
#get_bolb = > ''
|
59
|
+
end
|
60
|
+
|
61
|
+
it "SkypeAPI::Chat.createUsingBlob(@chat.get_blob) should raise error SkypeAPI::Error::API" do
|
62
|
+
lambda{SkypeAPI::Chat.createUsingBlob(@chat.get_blob)}.should raise_error SkypeAPI::Error::API
|
63
|
+
#ERROR 611 CHAT: CREATEUSINGBLOB: Unable to create chat, invalid blob
|
64
|
+
#get_bolb = > ''
|
65
|
+
end
|
66
|
+
|
67
|
+
it "get_name should be instance of String and not empty and == chat id" do
|
68
|
+
@chat.get_name.should be_instance_of String
|
69
|
+
@chat.get_name.should_not be_empty
|
70
|
+
@chat.get_name.should == @chat.to_s
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'get_timestamp should be_instance_of Time or nil?' do
|
74
|
+
if @chat.getTimestamp.nil?
|
75
|
+
pending 'i phave not time'
|
76
|
+
else
|
77
|
+
@chat.getTimestamp.should be_instance_of Time
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'get_adder should be instance of User.but self create chat should be nil' do
|
82
|
+
@chat.get_adder.should be_nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it "get_status should match /(LEGACY_DIALOG)|(DIALOG)|(MULTI_SUBSCRIBED)|(UNSUBSCRIBED)/" do
|
86
|
+
@chat.get_status.should match /^(LEGACY_DIALOG)|(DIALOG)|(MULTI_SUBSCRIBED)|(UNSUBSCRIBED)$/
|
87
|
+
end
|
88
|
+
|
89
|
+
it "get_posters each should be instance of User" do
|
90
|
+
@chat.sendMessage 'hoge'
|
91
|
+
pending 'no posters' if @chat.get_posters.empty?
|
92
|
+
@chat.get_posters.each do |user|
|
93
|
+
user.should be_instance_of SkypeAPI::User
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it "get_members each should be instance of ChatMember" do
|
98
|
+
pending 'no member'# if @chat.get_members.empty?
|
99
|
+
@chat.getMembers.each do |chat_member|
|
100
|
+
chat_member.should be_instance_of SkypeAPI::ChatMember
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
it "get_topic should be instance of String and empty" do
|
105
|
+
@chat.getTopic.should be_instance_of String
|
106
|
+
@chat.getTopic.should be_empty
|
107
|
+
end
|
108
|
+
|
109
|
+
it "set_topic(string) should raise_error SkypeAPI::Error::API" do
|
110
|
+
lambda{@chat.setTopic('TEST')}.should raise_error SkypeAPI::Error::API
|
111
|
+
end
|
112
|
+
|
113
|
+
it "get_topic_xml should be instance of String and empty" do
|
114
|
+
@chat.getTopicXML.should be_instance_of String
|
115
|
+
@chat.getTopicXML.should be_empty
|
116
|
+
end
|
117
|
+
|
118
|
+
it "set_topic_xml(string) should raise error SkypeAPI::Error::API" do
|
119
|
+
lambda{@chat.setTopicXML('<BLINK>topic is blinking</BLINK>')}.should raise_error SkypeAPI::Error::API
|
120
|
+
end
|
121
|
+
|
122
|
+
it "get_chat_messages each should be instance of ChatMessage" do
|
123
|
+
@chat.send_message 'hoge'
|
124
|
+
@chat.getChatMessages.each do |chat_message|
|
125
|
+
chat_message.should be_instance_of SkypeAPI::ChatMessage
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
it "get_active_members each should be instance of ChatMember" do
|
130
|
+
pending 'user or member'
|
131
|
+
@chat.getActiveMembers.each do |member|
|
132
|
+
member.should be_instance_of SkypeAPI::ChatMember
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
it "get_friendly_name should be instance of String" do
|
137
|
+
@chat.getFriendlyName.should be_instance_of String
|
138
|
+
end
|
139
|
+
|
140
|
+
it "get_recent_chat_messages each should be instance of Chat" do
|
141
|
+
@chat.send_message 'hoge'
|
142
|
+
@chat.getRecentChatMessages.each do |chat_message|
|
143
|
+
chat_message.should be_instance_of SkypeAPI::ChatMessage
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
it "bookmarked should be true and get_bookmarked should be true and unbookmarked should be true and get_bookmarked should be false" do
|
148
|
+
@chat.bookmarked.should be_true
|
149
|
+
@chat.getBookmarked.should be_true
|
150
|
+
@chat.unbookmarked.should be_true
|
151
|
+
@chat.getBookmarked.should be_false
|
152
|
+
end
|
153
|
+
|
154
|
+
it "get_member_objects each should be instance of ChatMember" do
|
155
|
+
@chat.getMemberObjects.each do |chat_member|
|
156
|
+
chat_member.should be_instance_of SkypeAPI::ChatMember
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
160
|
+
it "get_password_hint should be instance of String and empty" do
|
161
|
+
@chat.getPasswordHint.should be_instance_of String
|
162
|
+
@chat.getPasswordHint.should be_empty
|
163
|
+
end
|
164
|
+
|
165
|
+
it "set_guid_lines(string) should be raise error SkypeAPI::Error::API" do
|
166
|
+
lambda{@chat.setGuideLines('TEST')}.should raise_error SkypeAPI::Error::API
|
167
|
+
end
|
168
|
+
|
169
|
+
it "get_options should be_kind_of" do
|
170
|
+
@chat.getOptions.should be_kind_of Integer
|
171
|
+
end
|
172
|
+
|
173
|
+
it "set_options(integer) should raise error SkypeAPI::Error::API" do
|
174
|
+
lambda{@chat.setOptions(1)}.should raise_error SkypeAPI::Error::API
|
175
|
+
end
|
176
|
+
|
177
|
+
it "get_description should be instance of String" do
|
178
|
+
@chat.getDescription.should be_instance_of String
|
179
|
+
end
|
180
|
+
|
181
|
+
it "get_dialog_partner should be instance of User or nil" do
|
182
|
+
pending 'nil' if @chat.getDialogPartner.nil?
|
183
|
+
@chat.getDialogPartner.should be_instance_of SkypeAPI::User
|
184
|
+
end
|
185
|
+
|
186
|
+
it "get_activity_timestamp should be instance of Time" do
|
187
|
+
@chat.getActivityTimestamp.should be_instance_of Time
|
188
|
+
end
|
189
|
+
|
190
|
+
it "get_type should match /(LEGACY_DIALOG)|(DIALOG)|(MULTICHAT)|(SHAREDGROUP)|(LEGACY_UNSUBSCRIBED)/" do
|
191
|
+
@chat.getType.should match /(LEGACY_DIALOG)|(DIALOG)|(MULTICHAT)|(SHAREDGROUP)|(LEGACY_UNSUBSCRIBED)/
|
192
|
+
end
|
193
|
+
|
194
|
+
it "get_my_status should match /(CONNECTING)|(WAITING_REMOTE_ACCEPT)|(ACCEPT_REQUIRED)|(PASSWORD_REQUIRED)|(SUBSCRIBED)|(UNSUBSCRIBED)|(CHAT_DISBANDED)|(QUEUED_BECAUSE_CHAT_IS_FULL)|(APPLICATION_DENIED)|(KICKED)|(BANNED)|(RETRY_CONNECTING)/" do
|
195
|
+
@chat.getMyStatus.should match /(CONNECTING)|(WAITING_REMOTE_ACCEPT)|(ACCEPT_REQUIRED)|(PASSWORD_REQUIRED)|(SUBSCRIBED)|(UNSUBSCRIBED)|(CHAT_DISBANDED)|(QUEUED_BECAUSE_CHAT_IS_FULL)|(APPLICATION_DENIED)|(KICKED)|(BANNED)|(RETRY_CONNECTING)/
|
196
|
+
end
|
197
|
+
|
198
|
+
it "get_my_role should match /(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)/" do
|
199
|
+
@chat.getMyRole.should match /(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)/
|
200
|
+
end
|
201
|
+
|
202
|
+
it "get_blob should be instance of String and empty" do
|
203
|
+
blob = @chat.getBlob
|
204
|
+
blob.should be_instance_of String
|
205
|
+
blob.should be_empty
|
206
|
+
end
|
207
|
+
|
208
|
+
it "get_applicants each should be instance of User" do
|
209
|
+
pending 'no,,,' if @chat.getApplicants.empty?
|
210
|
+
@chat.getApplicants.each do |user|
|
211
|
+
user.should be_instance_of SkypeAPI::User
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
it "leave should raise SkypeAPI::Error::API" do
|
216
|
+
lambda{@chat.leave}.should raise_error SkypeAPI::Error::API
|
217
|
+
end
|
218
|
+
|
219
|
+
it "join should raise error SkypeAPI::Error::API" do
|
220
|
+
lambda{@chat.join}.should raise_error SkypeAPI::Error::API
|
221
|
+
end
|
222
|
+
|
223
|
+
it "clearRecentMessages should be true" do
|
224
|
+
@chat.clearRecentMessages.should be_true
|
225
|
+
end
|
226
|
+
|
227
|
+
it "alert_string(string) should be true" do
|
228
|
+
@chat.setAlertString('hoge').should be_true
|
229
|
+
end
|
230
|
+
|
231
|
+
it "acceptadd should should raise error SkypeAPI::Error::API" do
|
232
|
+
lambda{@chat.acceptadd}.should raise_error SkypeAPI::Error::API
|
233
|
+
end
|
234
|
+
|
235
|
+
it "disband should should raise error SkypeAPI::Error::API" do
|
236
|
+
lambda{@chat.disband}.should raise_error SkypeAPI::Error::API
|
237
|
+
end
|
238
|
+
|
239
|
+
it "set_password(string) should raise enrror SkypeAPI::Error::API" do
|
240
|
+
lambda{@chat.setPassword('hogehoge')}.should raise_error SkypeAPI::Error::API
|
241
|
+
end
|
242
|
+
|
243
|
+
it "enter_password(string) should raise error SkypeAPI::Error::API" do
|
244
|
+
lambda{@chat.enterPassword('hogehoge')}.should raise_error SkypeAPI::Error::API
|
245
|
+
end
|
246
|
+
|
247
|
+
it "kick(string) should raise error SkypeAPI::Error::API" do
|
248
|
+
lambda{@chat.kick('echo123')}.should raise_error SkypeAPI::Error::API
|
249
|
+
end
|
250
|
+
|
251
|
+
it "kick(user) should raise error SkypeAPI::Error::API" do
|
252
|
+
lambda{@chat.kick(SkypeAPI.user('echo123'))}.should raise_error SkypeAPI::Error::API
|
253
|
+
end
|
254
|
+
|
255
|
+
it "kick_ban(string) should raise error SkypeAPI::Error::API" do
|
256
|
+
lambda{@chat.kickban('echo123')}.should raise_error SkypeAPI::Error::API
|
257
|
+
end
|
258
|
+
|
259
|
+
it "kick_ban(user) should raise error SkypeAPI::Error::API" do
|
260
|
+
lambda{@chat.kickban(SkypeAPI.user('echo123'))}.should raise_error SkypeAPI::Error::API
|
261
|
+
end
|
262
|
+
|
263
|
+
it "send_message should be instance of" do
|
264
|
+
@chat.sendMessage('test').should be_instance_of SkypeAPI::ChatMessage
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
describe 'in 3 people' do
|
269
|
+
before :each do
|
270
|
+
#pending 'hoge'
|
271
|
+
@chat = SkypeAPI::Chat.create 'echo123','hogehoge_001'
|
272
|
+
end
|
273
|
+
|
274
|
+
after :each do
|
275
|
+
@chat.leave if @chat
|
276
|
+
end
|
277
|
+
|
278
|
+
it "SkypeAPI::Chat.findUsingBlob(@chat.get_blob) should raise error SkypeAPI::Error::API" do
|
279
|
+
SkypeAPI::Chat.findUsingBlob(@chat.get_blob).should == @chat
|
280
|
+
#ERROR 610 CHAT: FINDUSINGBLOB: No existing chat for given blob found or invalid blob
|
281
|
+
#get_bolb = > ''
|
282
|
+
end
|
283
|
+
|
284
|
+
it "SkypeAPI::Chat.createUsingBlob(@chat.get_blob) should raise error SkypeAPI::Error::API" do
|
285
|
+
SkypeAPI::Chat.createUsingBlob(@chat.get_blob).should == @chat
|
286
|
+
#ERROR 611 CHAT: CREATEUSINGBLOB: Unable to create chat, invalid blob
|
287
|
+
#get_bolb = > ''
|
288
|
+
end
|
289
|
+
|
290
|
+
it "get_blob should be instance of String and not empty" do
|
291
|
+
blob = @chat.getBlob
|
292
|
+
blob.should be_instance_of String
|
293
|
+
blob.should_not be_empty
|
294
|
+
end
|
295
|
+
|
296
|
+
it "set_topic(string) should raise_error SkypeAPI::Error::API" do
|
297
|
+
@chat.setTopic('TEST').should be_true
|
298
|
+
end
|
299
|
+
|
300
|
+
it "set_topic_xml(string) should raise error SkypeAPI::Error::API" do
|
301
|
+
@chat.setTopicXML('<BLINK>topic is blinking</BLINK>').should be_true
|
302
|
+
end
|
303
|
+
|
304
|
+
it "set_options(integer) should be true" do
|
305
|
+
lambda{@chat.setOptions(1)}.should raise_error SkypeAPI::Error::API
|
306
|
+
end
|
307
|
+
|
308
|
+
it "set_guid_lines(string) should be raise error SkypeAPI::Error::API" do
|
309
|
+
lambda{@chat.setGuideLines('TEST')}.should raise_error SkypeAPI::Error::API
|
310
|
+
end
|
311
|
+
|
312
|
+
it "leave should raise SkypeAPI::Error::API" do
|
313
|
+
@chat.leave.should be_true
|
314
|
+
@chat = nil
|
315
|
+
end
|
316
|
+
|
317
|
+
it "join should raise error SkypeAPI::Error::API" do
|
318
|
+
@chat.join.should be_true
|
319
|
+
end
|
320
|
+
|
321
|
+
it "acceptadd should should raise error SkypeAPI::Error::API" do
|
322
|
+
@chat.acceptadd.should be_true
|
323
|
+
#
|
324
|
+
end
|
325
|
+
|
326
|
+
it "disband should should be true" do
|
327
|
+
lambda{@chat.disband}.should raise_error SkypeAPI::Error::API
|
328
|
+
end
|
329
|
+
|
330
|
+
it "set_password(string) should raise error SkypeAPI::Error::API" do
|
331
|
+
@chat.setPassword('hogehoge').should be_true
|
332
|
+
end
|
333
|
+
|
334
|
+
it "enter_password(string) should raise error SkypeAPI::Error::API" do
|
335
|
+
lambda{@chat.enterPassword('hogehoge')}.should raise_error SkypeAPI::Error::API
|
336
|
+
end
|
337
|
+
|
338
|
+
it "kick(string) should be true" do
|
339
|
+
@chat.kick('echo123').should be_true
|
340
|
+
end
|
341
|
+
|
342
|
+
it "kick(user) should be true" do
|
343
|
+
@chat.kick(SkypeAPI.user('echo123')).should be_true
|
344
|
+
end
|
345
|
+
|
346
|
+
it "kick_ban(string) should be true" do
|
347
|
+
@chat.kickban('echo123').should be_true
|
348
|
+
end
|
349
|
+
|
350
|
+
it "kick_ban(user) should be true" do
|
351
|
+
@chat.kickban(SkypeAPI.user('echo123')).should be_true
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
require 'skypeapi'
|
5
|
+
require 'matcher_be_boolean'
|
6
|
+
|
7
|
+
describe SkypeAPI::ChatMember do
|
8
|
+
before(:all) do
|
9
|
+
SkypeAPI.init
|
10
|
+
SkypeAPI.start_messageloop
|
11
|
+
SkypeAPI.attach_wait
|
12
|
+
end
|
13
|
+
before(:each) do
|
14
|
+
@chat = SkypeAPI::Chat.create 'echo123'
|
15
|
+
@chatmember = @chat.get_member_objects[0]
|
16
|
+
end
|
17
|
+
|
18
|
+
it "get_chat should be instance of Chat" do
|
19
|
+
@chatmember.get_chat.should be_instance_of SkypeAPI::Chat
|
20
|
+
end
|
21
|
+
|
22
|
+
it "get_user should be instance of User" do
|
23
|
+
@chatmember.get_user.should be_instance_of SkypeAPI::User
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'get_role should match /^(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)$/' do
|
27
|
+
@chatmember.get_role.should match /^(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)$/
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'get_is_active? should be boolean' do
|
31
|
+
@chatmember.get_is_active?.should be_boolean
|
32
|
+
end
|
33
|
+
|
34
|
+
it "can_set_role_to('MATER') should be true" do
|
35
|
+
@chatmember.can_set_role_to?('MASTER').should be_true
|
36
|
+
end
|
37
|
+
|
38
|
+
it "set_role_to('MASTER') should raise error" do
|
39
|
+
lambda{@chatmember.set_role_to('MASTER')}.should raise_error SkypeAPI::Error::API
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# To change this template, choose Tools | Templates
|
2
|
+
# and open the template in the editor.
|
3
|
+
|
4
|
+
require 'skypeapi'
|
5
|
+
require 'matcher_be_boolean'
|
6
|
+
|
7
|
+
describe SkypeAPI::ChatMessage do
|
8
|
+
|
9
|
+
before :all do
|
10
|
+
SkypeAPI.init
|
11
|
+
SkypeAPI.start_messageloop
|
12
|
+
SkypeAPI.attach_wait
|
13
|
+
end
|
14
|
+
|
15
|
+
before(:each) do
|
16
|
+
@chat = SkypeAPI::Chat.create('echo123', 'fk.8600gt')
|
17
|
+
@chatmessage = @chat.send_message 'chatmessage test'
|
18
|
+
end
|
19
|
+
|
20
|
+
after do
|
21
|
+
@chat.leave
|
22
|
+
end
|
23
|
+
|
24
|
+
it "get_timestamp shoulb be instance of Time" do
|
25
|
+
@chatmessage.get_timestamp.should be_instance_of Time
|
26
|
+
end
|
27
|
+
|
28
|
+
it "get_from should be instance of User" do
|
29
|
+
@chatmessage.get_from.should be_instance_of SkypeAPI::User
|
30
|
+
end
|
31
|
+
|
32
|
+
it "get_from_dispname should be instance of String" do
|
33
|
+
@chatmessage.get_from_dispname.should be_instance_of String
|
34
|
+
end
|
35
|
+
|
36
|
+
it "get_type should match /(SETTOPIC)|(SAID)|(ADDEDMEMBERS)|(SAWMEMBERS)|(CREATEDCHATWITH)|(LEFT)|(POSTEDCONTACTS)|(GAP_IN_CHAT)|(SETROLE)|(KICKED)|(KICKBANNED)|(SETOPTIONS)|(SETPICTURE)|(SETGUIDELINES)|(JOINEDASAPPLICANT)|(UNKNOWN)/" do
|
37
|
+
@chatmessage.get_type.should match /(SETTOPIC)|(SAID)|(ADDEDMEMBERS)|(SAWMEMBERS)|(CREATEDCHATWITH)|(LEFT)|(POSTEDCONTACTS)|(GAP_IN_CHAT)|(SETROLE)|(KICKED)|(KICKBANNED)|(SETOPTIONS)|(SETPICTURE)|(SETGUIDELINES)|(JOINEDASAPPLICANT)|(UNKNOWN)/
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'get_status should match /(SENDING)|(SENT)|(RECEIVED)|(READ)/' do
|
41
|
+
@chatmessage.get_status.should match /(SENDING)|(SENT)|(RECEIVED)|(READ)/
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'get_leave_reason should nil or match /(USER_NOT_FOUND)|(USER_INCAPABLE)|(ADDER_MUST_BE_FRIEND)|(ADDED_MUST_BE_AUTHORIZED)|(UNSUBSCRIBE)/' do
|
45
|
+
@chatmessage.get_leave_reason.should be_nil
|
46
|
+
pending 'this test need type LEFT'
|
47
|
+
@chatmessage.get_leave_reason.should match /(USER_NOT_FOUND)|(USER_INCAPABLE)|(ADDER_MUST_BE_FRIEND)|(ADDED_MUST_BE_AUTHORIZED)|(UNSUBSCRIBE)/
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'get_chat should be instance of Chat' do
|
51
|
+
@chatmessage.get_chat.should be_instance_of SkypeAPI::Chat
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'get_users each should be instance of User' do
|
55
|
+
@chatmessage.get_users.each{|user| user.should be_instance_of SkypeAPI::User}
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'get_is_editable? should be boolean' do
|
59
|
+
@chatmessage.get_is_editable?.should be_boolean
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'get_edited_by should be nil or instance of User' do
|
63
|
+
@chatmessage.get_edited_by.should be_nil
|
64
|
+
@chatmessage.set_body('testEdit')
|
65
|
+
@chatmessage.get_edited_by.should be_instance_of SkypeAPI::User
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'get_edited_timestamp should be nil or instance of Time' do
|
69
|
+
@chatmessage.get_edited_timestamp.should be_instance_of Time
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'get_option should be kind of Integer' do
|
73
|
+
@chatmessage.get_options.should be_kind_of Integer
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'get_role should match /(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)|(UNKNOWN)/' do
|
77
|
+
@chatmessage.get_role.should match /(CREATOR)|(MASTER)|(HELPER)|(USER)|(LISTENER)|(APPLICANT)|(UNKNOWN)/
|
78
|
+
end
|
79
|
+
|
80
|
+
it 'set_body("hoge") should be_true and get_body should "hoge"' do
|
81
|
+
@chatmessage.set_body('hoge').should be_true
|
82
|
+
@chatmessage.get_body.should == 'hoge'
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'set_seen should be true' do
|
86
|
+
@chatmessage.set_seen.should be_true
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|