exchanger 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +1,13 @@
1
1
  require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
2
 
3
+ SUBJECT = "Test Calendar Item"
4
+
3
5
  describe Exchanger::CalendarItem do
4
6
  before do
5
7
  @folder = VCR.use_cassette('folder/find_calendar') do
6
8
  Exchanger::Folder.find(:calendar)
7
9
  end
8
- @calendar_item = @folder.new_calendar_item
10
+ @calendar_item = @folder.new_calendar_item(subject: SUBJECT, body: Exchanger::Body.new(text: "Body line 1.\nBody line 2."), start: Time.now, end: Time.now + 30.minutes)
9
11
  end
10
12
 
11
13
  describe "#save" do
@@ -20,22 +22,46 @@ describe Exchanger::CalendarItem do
20
22
  it "should create and update calendar item" do
21
23
  VCR.use_cassette("calendar_item/save") do
22
24
  prev_items_size = @folder.items.size
23
- @calendar_item.subject = "Calendar Item Subject"
24
- @calendar_item.body = Exchanger::Body.new(text: "Body line 1.\nBody line 2.")
25
- @calendar_item.start = Time.now
26
- @calendar_item.end = Time.now + 30.minutes
27
25
  @calendar_item.should be_changed
28
26
  @calendar_item.save
29
27
  @calendar_item.should_not be_new_record
30
28
  @calendar_item.should_not be_changed
31
29
  @calendar_item.reload
32
- @calendar_item.subject.should == "Calendar Item Subject"
30
+ @calendar_item.subject.should == SUBJECT
33
31
  @folder.items.size.should == prev_items_size + 1
34
- @calendar_item.subject = "Calendar Item Subject - Updated"
32
+ @calendar_item.subject += " Updated"
35
33
  @calendar_item.should be_changed
36
34
  @calendar_item.save
37
35
  @calendar_item.should_not be_changed
38
36
  end
39
37
  end
40
38
  end
39
+
40
+ describe "#file_attachment" do
41
+ after do
42
+ if @calendar_item.persisted?
43
+ VCR.use_cassette("calendar_item/save_file_attachment_cleanup") do
44
+ @calendar_item.destroy
45
+ end
46
+ end
47
+ end
48
+
49
+ it "should create and read file attachments" do
50
+ VCR.use_cassette("calendar_item/save_file_attachment") do
51
+ @calendar_item.save
52
+
53
+ content = "Test Content"
54
+ file_attachment = @calendar_item.new_file_attachment(name: "test.txt", content_type: "text/plain", content: content)
55
+ file_attachment.save
56
+
57
+ @calendar_item.reload # Pull attachment metadata using GetItem
58
+ @calendar_item.attachments.size.should == 1
59
+
60
+ attachment = Exchanger::Attachment.find(@calendar_item.attachments[0].id) # Pull attachment content using GetAttachment
61
+ attachment.content.should == content
62
+
63
+ attachment.destroy
64
+ end
65
+ end
66
+ end
41
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exchanger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Edgars Beigarts
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-09 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -207,6 +207,7 @@ files:
207
207
  - lib/exchanger/config.rb
208
208
  - lib/exchanger/dirty.rb
209
209
  - lib/exchanger/element.rb
210
+ - lib/exchanger/elements/attachment.rb
210
211
  - lib/exchanger/elements/attendee.rb
211
212
  - lib/exchanger/elements/base_folder.rb
212
213
  - lib/exchanger/elements/body.rb
@@ -221,10 +222,12 @@ files:
221
222
  - lib/exchanger/elements/distribution_list.rb
222
223
  - lib/exchanger/elements/email_address.rb
223
224
  - lib/exchanger/elements/entry.rb
225
+ - lib/exchanger/elements/file_attachment.rb
224
226
  - lib/exchanger/elements/folder.rb
225
227
  - lib/exchanger/elements/identifier.rb
226
228
  - lib/exchanger/elements/im_address.rb
227
229
  - lib/exchanger/elements/item.rb
230
+ - lib/exchanger/elements/item_attachment.rb
228
231
  - lib/exchanger/elements/mailbox.rb
229
232
  - lib/exchanger/elements/meeting_cancellation.rb
230
233
  - lib/exchanger/elements/meeting_message.rb
@@ -239,11 +242,14 @@ files:
239
242
  - lib/exchanger/elements/tasks_folder.rb
240
243
  - lib/exchanger/field.rb
241
244
  - lib/exchanger/operation.rb
245
+ - lib/exchanger/operations/create_attachment.rb
242
246
  - lib/exchanger/operations/create_item.rb
247
+ - lib/exchanger/operations/delete_attachment.rb
243
248
  - lib/exchanger/operations/delete_item.rb
244
249
  - lib/exchanger/operations/expand_dl.rb
245
250
  - lib/exchanger/operations/find_folder.rb
246
251
  - lib/exchanger/operations/find_item.rb
252
+ - lib/exchanger/operations/get_attachment.rb
247
253
  - lib/exchanger/operations/get_folder.rb
248
254
  - lib/exchanger/operations/get_item.rb
249
255
  - lib/exchanger/operations/get_user_availability.rb
@@ -253,6 +259,8 @@ files:
253
259
  - lib/exchanger/version.rb
254
260
  - spec/cassettes/calendar_item/save.yml
255
261
  - spec/cassettes/calendar_item/save_cleanup.yml
262
+ - spec/cassettes/calendar_item/save_file_attachment.yml
263
+ - spec/cassettes/calendar_item/save_file_attachment_cleanup.yml
256
264
  - spec/cassettes/contact/destroy.yml
257
265
  - spec/cassettes/contact/destroy_setup.yml
258
266
  - spec/cassettes/contact/find.yml