mail_sandbox 0.1.2 → 0.1.3
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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Rakefile +0 -11
- data/lib/mail_sandbox/message.rb +5 -10
- data/lib/mail_sandbox/observer/http.rb +1 -1
- data/lib/mail_sandbox/server.rb +1 -1
- data/lib/mail_sandbox/version.rb +1 -1
- data/test/integration/em_server_test.rb +29 -0
- data/test/integration/spawn_test.rb +0 -4
- data/test/test_helper.rb +3 -1
- data/test/unit/subscribe_test.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef6649dc80fe7dcd6423161ccf0a0da3e627ea3b
|
4
|
+
data.tar.gz: 147f787b4e8a434b28aec93ebb5e5892c8808690
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d889269dc9a2240f33293c1c607b44275c9bd381e2d32ddf9242b566fd92239e290a6c16e260e2bcb9a74ccaa8c50937d6905dbbd7fbab982b57f735c84b3387
|
7
|
+
data.tar.gz: a1daeb78f6b0096a9fd04e12844568c99dabc1cc481262df70f561eaa5966127a52a6eab733762eaa905c5db85aed08a568db1ef19fe848558553823bf2c47d3
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,13 +1,2 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require "bundler/gem_tasks"
|
3
|
-
require 'rake/testtask'
|
4
|
-
|
5
|
-
task :default => :test
|
6
|
-
Rake::TestTask.new do |t|
|
7
|
-
t.libs << "test"
|
8
|
-
t.test_files = FileList['test/lib/**/*_test.rb']
|
9
|
-
t.verbose = true
|
10
|
-
end
|
11
|
-
|
12
|
-
desc "Run tests"
|
13
|
-
task :default => :test
|
data/lib/mail_sandbox/message.rb
CHANGED
@@ -2,31 +2,26 @@ require 'json'
|
|
2
2
|
|
3
3
|
module MailSandbox
|
4
4
|
class Message
|
5
|
-
|
6
|
-
attr_accessor :data, :recipient, :sender, :completed_at,
|
7
|
-
:user,
|
8
|
-
:password
|
9
|
-
|
5
|
+
attr_accessor :data, :recipients, :sender, :completed_at, :user, :password
|
10
6
|
|
11
7
|
def initialize
|
12
8
|
@data = []
|
9
|
+
@recipients = []
|
13
10
|
end
|
14
11
|
|
15
12
|
def to_json
|
16
|
-
|
13
|
+
to_hash.to_json
|
17
14
|
end
|
18
15
|
|
19
|
-
|
20
|
-
def to_a
|
16
|
+
def to_hash
|
21
17
|
{
|
22
18
|
:password => password,
|
23
19
|
:user => user,
|
24
|
-
:
|
20
|
+
:recipients => recipients.join(','),
|
25
21
|
:sender => sender,
|
26
22
|
:completed_at => completed_at,
|
27
23
|
:data => data.join("\r\n"),
|
28
24
|
}
|
29
25
|
end
|
30
|
-
|
31
26
|
end
|
32
27
|
end
|
data/lib/mail_sandbox/server.rb
CHANGED
data/lib/mail_sandbox/version.rb
CHANGED
@@ -0,0 +1,29 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class EmServerTest < MiniTest::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@em_host = 'localhost'
|
6
|
+
@em_port = 2525
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_multiple_recipients
|
10
|
+
c = nil
|
11
|
+
EM.run {
|
12
|
+
EM.start_server(@em_host, @em_port, MailSandbox::Server) { |conn| c = conn }
|
13
|
+
|
14
|
+
EM::Timer.new(5) { EM.stop }
|
15
|
+
|
16
|
+
EM::Protocols::SmtpClient.send ({
|
17
|
+
host: @em_host,
|
18
|
+
port: @em_port,
|
19
|
+
domain: "example.com",
|
20
|
+
from: "me@example.com",
|
21
|
+
to: ["you@example.com", "we@example.com"],
|
22
|
+
header: {"Subject"=>"Email subject line", "Reply-to"=>"me@example.com"},
|
23
|
+
body: "Not much of interest here."
|
24
|
+
})
|
25
|
+
}
|
26
|
+
|
27
|
+
assert_equal( c.message.recipients, ["<you@example.com>", "<we@example.com>"] )
|
28
|
+
end
|
29
|
+
end
|
data/test/test_helper.rb
CHANGED
data/test/unit/subscribe_test.rb
CHANGED
@@ -23,7 +23,7 @@ class SubscribeTest < MiniTest::Unit::TestCase
|
|
23
23
|
|
24
24
|
def test_http_observer
|
25
25
|
url = "http://localhost/api"
|
26
|
-
body = {:body => {:message => @message.
|
26
|
+
body = {:body => {:message => @message.to_hash}}
|
27
27
|
|
28
28
|
http_mock = mock()
|
29
29
|
http_mock.stubs(:callback)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mail_sandbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaize
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- test/fixtures/http_response.txt
|
167
167
|
- test/fixtures/message.txt
|
168
168
|
- test/integration/daemonize_test.rb
|
169
|
+
- test/integration/em_server_test.rb
|
169
170
|
- test/integration/pidfile_test.rb
|
170
171
|
- test/integration/spawn_test.rb
|
171
172
|
- test/support/config.yml
|
@@ -192,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
192
193
|
version: '0'
|
193
194
|
requirements: []
|
194
195
|
rubyforge_project:
|
195
|
-
rubygems_version: 2.1.
|
196
|
+
rubygems_version: 2.1.10
|
196
197
|
signing_key:
|
197
198
|
specification_version: 4
|
198
199
|
summary: SMTP server sandbox
|
@@ -200,6 +201,7 @@ test_files:
|
|
200
201
|
- test/fixtures/http_response.txt
|
201
202
|
- test/fixtures/message.txt
|
202
203
|
- test/integration/daemonize_test.rb
|
204
|
+
- test/integration/em_server_test.rb
|
203
205
|
- test/integration/pidfile_test.rb
|
204
206
|
- test/integration/spawn_test.rb
|
205
207
|
- test/support/config.yml
|
@@ -207,4 +209,3 @@ test_files:
|
|
207
209
|
- test/test_helper.rb
|
208
210
|
- test/unit/config_test.rb
|
209
211
|
- test/unit/subscribe_test.rb
|
210
|
-
has_rdoc:
|