mailboxer_multi_attach 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -38,8 +38,8 @@ describe "Attaching a message" do
38
38
  let(:entity2) { FactoryGirl.create(:user) }
39
39
  let(:attachments) { [{ :file => File.open('spec/testfile.txt') }, { :file => File.open('spec/1.mp4') }] }
40
40
  let!(:receipt) { entity1.send_message_mult_attach(entity2, "Body", "Subject", true, attachments)}
41
- let!(:receipt_from_reply) { entity1.reply_to_sender_mult_attach(receipt, "Body", "Subject", true, attachments) }
42
- let!(:message) { receipt_from_reply.message }
41
+ let!(:receipt_from_reply_to_sender) { entity1.reply_to_sender_mult_attach(receipt, "Body", "Subject", true, attachments) }
42
+ let!(:message) { receipt_from_reply_to_sender.message }
43
43
  it "attaches a file" do
44
44
  expect(message.message_attachments.first.file.file.filename).to eq "testfile.txt"
45
45
  end
@@ -64,4 +64,36 @@ describe "Attaching a message" do
64
64
  end
65
65
  end
66
66
  end
67
+ describe ".reply_to_convo_mult_attach" do
68
+ let(:entity1) { FactoryGirl.create(:user) }
69
+ let(:entity2) { FactoryGirl.create(:user) }
70
+ let(:attachments) { [{ :file => File.open('spec/testfile.txt') }, { :file => File.open('spec/1.mp4') }] }
71
+ let!(:receipt) { entity1.send_message_mult_attach(entity2, "Body", "Subject", attachments: attachments)}
72
+ let!(:conversation) { receipt.conversation }
73
+ let!(:receipt_from_reply_to_convo) { entity1.reply_to_convo_mult_attach(conversation, "Body", "Subject", true, true, attachments) }
74
+ let!(:message) { receipt_from_reply_to_convo.message }
75
+ it "attaches a file" do
76
+ expect(message.message_attachments.first.file.file.filename).to eq "testfile.txt"
77
+ end
78
+ it "stores the content type of a plain text file" do
79
+ expect(message.message_attachments.first.file.content_type).to eq 'text/plain'
80
+ end
81
+ it "stores the content type of a video file" do
82
+ expect(message.message_attachments.second.file.content_type).to eq 'application/mp4'
83
+ end
84
+ it "attaches two files" do
85
+ expect(message.message_attachments.count).to eq 2
86
+ end
87
+ it "returns the filename after the upload" do
88
+ expect(message.message_attachments.first.file.file.filename).to eq 'testfile.txt'
89
+ end
90
+
91
+ context "without an attachment" do
92
+ subject { entity1.reply_to_convo_mult_attach(conversation, "Body", "Subject", true, true) }
93
+ it "has no message attachments" do
94
+ receipt = subject
95
+ expect(receipt.message.message_attachments).to eq([])
96
+ end
97
+ end
98
+ end
67
99
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailboxer_multi_attach
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Rodriguez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-03 00:00:00.000000000 Z
11
+ date: 2015-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails