ez-email 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/Gemfile +6 -0
- data/MANIFEST.md +1 -1
- data/Rakefile +5 -7
- data/ez-email.gemspec +3 -3
- data/lib/ez/email.rb +1 -1
- data/spec/ez_email_spec.rb +131 -0
- metadata +15 -14
- metadata.gz.sig +0 -0
- data/test/test_ez_email.rb +0 -147
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56351d26bc53601e5d605888ff80ed01a12b494e6d01f83b880522d0a45125f0
|
4
|
+
data.tar.gz: 453ebd91e1b9a272e8b7c30f0a976edae2c186339b136650640ddbd238c99400
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9976dfb4468dbe863d846bcd4464d7d02b39fcd7677662758cea12dae1dccb69f06532545a5f7da5fdb6fe72f4caf6c74c7b9b1ddb7ddf6ff42a2dad982533f1
|
7
|
+
data.tar.gz: 1fcd870649811645c84107630df6994e03402649587adef1df49b6aeb4095f10ce659c196e4113feb0a6a05e3f97efca508101fa481aacb0b651c074eed46758
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/Gemfile
ADDED
data/MANIFEST.md
CHANGED
data/Rakefile
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/clean'
|
3
|
-
require '
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
|
-
CLEAN.include("**/*.gem", "**/*.rbc")
|
5
|
+
CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
|
6
6
|
|
7
7
|
namespace :gem do
|
8
8
|
desc 'Build the ez-email gem'
|
@@ -20,9 +20,7 @@ namespace :gem do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
t.verbose = true
|
26
|
-
end
|
23
|
+
desc "Run the test suite"
|
24
|
+
RSpec::Core::RakeTask.new(:spec)
|
27
25
|
|
28
|
-
task :default => :
|
26
|
+
task :default => :spec
|
data/ez-email.gemspec
CHANGED
@@ -2,20 +2,20 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'ez-email'
|
5
|
-
spec.version = '0.
|
5
|
+
spec.version = '0.3.0'
|
6
6
|
spec.license = 'Apache-2.0'
|
7
7
|
spec.summary = 'Really easy emails'
|
8
8
|
spec.description = 'A very simple interface for sending email'
|
9
9
|
spec.author = 'Daniel Berger'
|
10
10
|
spec.email = 'djberg96@gmail.com'
|
11
11
|
spec.homepage = 'https://github.com/djberg96/ez-email'
|
12
|
-
spec.test_file = '
|
12
|
+
spec.test_file = 'spec/ez_email_spec.rb'
|
13
13
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
14
14
|
spec.cert_chain = Dir['certs/*']
|
15
15
|
|
16
16
|
spec.extra_rdoc_files = ['README.md', 'CHANGES.md', 'MANIFEST.md']
|
17
17
|
|
18
|
-
spec.add_development_dependency('
|
18
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
19
19
|
|
20
20
|
spec.metadata = {
|
21
21
|
'homepage_uri' => 'https://github.com/djberg96/ez-email',
|
data/lib/ez/email.rb
CHANGED
@@ -0,0 +1,131 @@
|
|
1
|
+
########################################################################
|
2
|
+
# ez_email_spec.rb
|
3
|
+
#
|
4
|
+
# Specs for the EZ::Email library.
|
5
|
+
########################################################################
|
6
|
+
require 'rspec'
|
7
|
+
require 'ez/email'
|
8
|
+
require 'socket'
|
9
|
+
require 'etc'
|
10
|
+
|
11
|
+
RSpec.describe EZ::Email do
|
12
|
+
let(:host){ Socket.gethostname }
|
13
|
+
let(:login){ Etc.getlogin }
|
14
|
+
|
15
|
+
before do
|
16
|
+
@to = 'foo@some_mail_service.com'
|
17
|
+
@from = 'bar@some_mail_service.com'
|
18
|
+
@subj = 'This is a test'
|
19
|
+
@body = 'How are you?'
|
20
|
+
|
21
|
+
@opts = {:to => @to, :from => @from, :subject => @subj, :body => @body }
|
22
|
+
@email = EZ::Email.new(@opts)
|
23
|
+
end
|
24
|
+
|
25
|
+
example "version is set to expected value" do
|
26
|
+
expect(EZ::Email::VERSION).to eq('0.3.0')
|
27
|
+
expect(EZ::Email::VERSION).to be_frozen
|
28
|
+
end
|
29
|
+
|
30
|
+
example "to getter method basic functionality" do
|
31
|
+
expect(@email).to respond_to(:to)
|
32
|
+
expect{ @email.to }.not_to raise_error
|
33
|
+
expect(@email.to).not_to be_nil
|
34
|
+
end
|
35
|
+
|
36
|
+
example "to getter method returns expected value" do
|
37
|
+
expect(@email.to).to eq(@to)
|
38
|
+
end
|
39
|
+
|
40
|
+
example "to setter method basic functionality" do
|
41
|
+
expect(@email).to respond_to(:to=)
|
42
|
+
expect{ @email.to = 'bogus@some_bogus.com' }.not_to raise_error
|
43
|
+
end
|
44
|
+
|
45
|
+
example "to setter actually sets value" do
|
46
|
+
@email.to = 'bogus@some_bogus.com'
|
47
|
+
expect('bogus@some_bogus.com').to eq(@email.to)
|
48
|
+
end
|
49
|
+
|
50
|
+
example "from getter basic functionality" do
|
51
|
+
expect(@email).to respond_to(:from)
|
52
|
+
expect{ @email.from }.not_to raise_error
|
53
|
+
expect(@email.from).not_to be_nil
|
54
|
+
end
|
55
|
+
|
56
|
+
example "from setter basic functionality" do
|
57
|
+
expect(@email).to respond_to(:from=)
|
58
|
+
expect{ @email.from = 'bogus@some_bogus.com' }.not_to raise_error
|
59
|
+
end
|
60
|
+
|
61
|
+
example "from method returns expected value" do
|
62
|
+
expect(@email.from).to eq(@from)
|
63
|
+
end
|
64
|
+
|
65
|
+
example "from defaults to username@host if not set in constructor" do
|
66
|
+
@email = EZ::Email.new(:to => 'x', :subject => 'x', :body => 'x')
|
67
|
+
expected = login << '@' << host
|
68
|
+
expect(@email.from).to eq(expected)
|
69
|
+
end
|
70
|
+
|
71
|
+
example "subject getter basic functionality" do
|
72
|
+
expect(@email).to respond_to(:subject)
|
73
|
+
expect{ @email.subject }.not_to raise_error
|
74
|
+
expect(@email.subject).not_to be_nil
|
75
|
+
end
|
76
|
+
|
77
|
+
example "subject setter basic functionality" do
|
78
|
+
expect(@email).to respond_to(:subject=)
|
79
|
+
expect{ @email.subject = 'bogus@bogus.com' }.not_to raise_error
|
80
|
+
end
|
81
|
+
|
82
|
+
example "subject method returns expected value" do
|
83
|
+
expect(@email.subject).to eq(@subj)
|
84
|
+
end
|
85
|
+
|
86
|
+
example "body getter basic functionality" do
|
87
|
+
expect(@email).to respond_to(:body)
|
88
|
+
expect{ @email.body }.not_to raise_error
|
89
|
+
expect(@email.body).not_to be_nil
|
90
|
+
end
|
91
|
+
|
92
|
+
example "body setter basic functionality" do
|
93
|
+
expect(@email).to respond_to(:body=)
|
94
|
+
expect{ @email.body = "Test" }.not_to raise_error
|
95
|
+
end
|
96
|
+
|
97
|
+
example "body method returns the expected value" do
|
98
|
+
expect(@email.body).to eq(@body)
|
99
|
+
end
|
100
|
+
|
101
|
+
example "mail_host getter basic functionality" do
|
102
|
+
expect(EZ::Email).to respond_to(:mail_host)
|
103
|
+
expect{ EZ::Email.mail_host }.not_to raise_error
|
104
|
+
expect(EZ::Email.mail_host).not_to be_nil
|
105
|
+
end
|
106
|
+
|
107
|
+
example "mail_host setter basic functionality" do
|
108
|
+
expect(EZ::Email).to respond_to(:mail_host=)
|
109
|
+
expect{ EZ::Email.mail_host = "Test" }.not_to raise_error
|
110
|
+
end
|
111
|
+
|
112
|
+
example "mail_port singleton getter basic functionality" do
|
113
|
+
expect(EZ::Email).to respond_to(:mail_port)
|
114
|
+
end
|
115
|
+
|
116
|
+
example "mail_port singleton setter basic functionality" do
|
117
|
+
expect(EZ::Email).to respond_to(:mail_port=)
|
118
|
+
end
|
119
|
+
|
120
|
+
example "mail_port method returns the expected value" do
|
121
|
+
expect(EZ::Email.mail_port).to eq(25)
|
122
|
+
end
|
123
|
+
|
124
|
+
example "deliver singleton method basic functionality" do
|
125
|
+
expect(EZ::Email).to respond_to(:deliver)
|
126
|
+
end
|
127
|
+
|
128
|
+
example "passing an invalid option to the constructor raises an error" do
|
129
|
+
expect{ EZ::Email.send(:new, {:bogus => 77}) }.to raise_error(ArgumentError)
|
130
|
+
end
|
131
|
+
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ez-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,22 +35,22 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date:
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
|
-
name:
|
41
|
+
name: rspec
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '3.9'
|
47
47
|
type: :development
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '3.9'
|
54
54
|
description: A very simple interface for sending email
|
55
55
|
email: djberg96@gmail.com
|
56
56
|
executables: []
|
@@ -61,9 +61,9 @@ extra_rdoc_files:
|
|
61
61
|
- MANIFEST.md
|
62
62
|
files:
|
63
63
|
- LICENSE
|
64
|
-
- test
|
65
|
-
- test/test_ez_email.rb
|
66
64
|
- ez-email.gemspec
|
65
|
+
- spec
|
66
|
+
- spec/ez_email_spec.rb
|
67
67
|
- README.md
|
68
68
|
- Rakefile
|
69
69
|
- MANIFEST.md
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- lib/ez-email.rb
|
74
74
|
- lib/ez
|
75
75
|
- lib/ez/email.rb
|
76
|
+
- Gemfile
|
76
77
|
- CHANGES.md
|
77
78
|
homepage: https://github.com/djberg96/ez-email
|
78
79
|
licenses:
|
@@ -84,7 +85,7 @@ metadata:
|
|
84
85
|
documentation_uri: https://github.com/djberg96/ez-email/wiki
|
85
86
|
source_code_uri: https://github.com/djberg96/ez-email
|
86
87
|
wiki_uri: https://github.com/djberg96/ez-email/wiki
|
87
|
-
post_install_message:
|
88
|
+
post_install_message:
|
88
89
|
rdoc_options: []
|
89
90
|
require_paths:
|
90
91
|
- lib
|
@@ -99,9 +100,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
- !ruby/object:Gem::Version
|
100
101
|
version: '0'
|
101
102
|
requirements: []
|
102
|
-
rubygems_version: 3.
|
103
|
-
signing_key:
|
103
|
+
rubygems_version: 3.1.4
|
104
|
+
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Really easy emails
|
106
107
|
test_files:
|
107
|
-
-
|
108
|
+
- spec/ez_email_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/test/test_ez_email.rb
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
########################################################################
|
2
|
-
# test_ez_email.rb
|
3
|
-
#
|
4
|
-
# Test suite for the EZ::Email library.
|
5
|
-
########################################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'ez/email'
|
8
|
-
require 'socket'
|
9
|
-
require 'etc'
|
10
|
-
|
11
|
-
class TC_EZ_Email < Test::Unit::TestCase
|
12
|
-
def self.startup
|
13
|
-
@@host = Socket.gethostname
|
14
|
-
@@login = Etc.getlogin
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@to = 'foo@some_mail_service.com'
|
19
|
-
@from = 'bar@some_mail_service.com'
|
20
|
-
@subj = 'This is a test'
|
21
|
-
@body = 'How are you?'
|
22
|
-
|
23
|
-
@opts = {:to => @to, :from => @from, :subject => @subj, :body => @body }
|
24
|
-
@email = EZ::Email.new(@opts)
|
25
|
-
end
|
26
|
-
|
27
|
-
test "version is set to expected value" do
|
28
|
-
assert_equal('0.2.2', EZ::Email::VERSION)
|
29
|
-
assert_true(EZ::Email::VERSION.frozen?)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "to getter method basic functionality" do
|
33
|
-
assert_respond_to(@email, :to)
|
34
|
-
assert_nothing_raised{ @email.to }
|
35
|
-
assert_not_nil(@email.to)
|
36
|
-
end
|
37
|
-
|
38
|
-
test "to getter method returns expected value" do
|
39
|
-
assert_equal(@to, @email.to)
|
40
|
-
end
|
41
|
-
|
42
|
-
test "to setter method basic functionality" do
|
43
|
-
assert_respond_to(@email, :to=)
|
44
|
-
assert_nothing_raised{ @email.to = 'bogus@some_bogus.com' }
|
45
|
-
end
|
46
|
-
|
47
|
-
test "to setter actually sets value" do
|
48
|
-
@email.to = 'bogus@some_bogus.com'
|
49
|
-
assert_equal(@email.to, 'bogus@some_bogus.com')
|
50
|
-
end
|
51
|
-
|
52
|
-
test "from getter basic functionality" do
|
53
|
-
assert_respond_to(@email, :from)
|
54
|
-
assert_nothing_raised{ @email.from }
|
55
|
-
assert_not_nil(@email.from)
|
56
|
-
end
|
57
|
-
|
58
|
-
test "from setter basic functionality" do
|
59
|
-
assert_respond_to(@email, :from=)
|
60
|
-
assert_nothing_raised{ @email.from = 'bogus@some_bogus.com' }
|
61
|
-
end
|
62
|
-
|
63
|
-
test "from method returns expected value" do
|
64
|
-
assert_equal(@from, @email.from)
|
65
|
-
end
|
66
|
-
|
67
|
-
test "from defaults to username@host if not set in constructor" do
|
68
|
-
@email = EZ::Email.new(:to => 'x', :subject => 'x', :body => 'x')
|
69
|
-
expected = @@login << '@' << @@host
|
70
|
-
assert_equal(expected, @email.from)
|
71
|
-
end
|
72
|
-
|
73
|
-
test "subject getter basic functionality" do
|
74
|
-
assert_respond_to(@email, :subject)
|
75
|
-
assert_nothing_raised{ @email.subject }
|
76
|
-
assert_not_nil(@email.subject)
|
77
|
-
end
|
78
|
-
|
79
|
-
test "subject setter basic functionality" do
|
80
|
-
assert_respond_to(@email, :subject=)
|
81
|
-
assert_nothing_raised{ @email.subject = 'bogus@bogus.com' }
|
82
|
-
end
|
83
|
-
|
84
|
-
test "subject method returns expected value" do
|
85
|
-
assert_equal(@subj, @email.subject)
|
86
|
-
end
|
87
|
-
|
88
|
-
test "body getter basic functionality" do
|
89
|
-
assert_respond_to(@email, :body)
|
90
|
-
assert_nothing_raised{ @email.body }
|
91
|
-
assert_not_nil(@email.body)
|
92
|
-
end
|
93
|
-
|
94
|
-
test "body setter basic functionality" do
|
95
|
-
assert_respond_to(@email, :body=)
|
96
|
-
assert_nothing_raised{ @email.body = "Test" }
|
97
|
-
end
|
98
|
-
|
99
|
-
test "body method returns the expected value" do
|
100
|
-
assert_equal(@body, @email.body)
|
101
|
-
end
|
102
|
-
|
103
|
-
test "mail_host getter basic functionality" do
|
104
|
-
assert_respond_to(EZ::Email, :mail_host)
|
105
|
-
assert_nothing_raised{ EZ::Email.mail_host }
|
106
|
-
assert_not_nil(EZ::Email.mail_host)
|
107
|
-
end
|
108
|
-
|
109
|
-
test "mail_host setter basic functionality" do
|
110
|
-
assert_respond_to(EZ::Email, :mail_host=)
|
111
|
-
assert_nothing_raised{ EZ::Email.mail_host = "Test" }
|
112
|
-
end
|
113
|
-
|
114
|
-
test "mail_port singleton getter basic functionality" do
|
115
|
-
assert_respond_to(EZ::Email, :mail_port)
|
116
|
-
end
|
117
|
-
|
118
|
-
test "mail_port singleton setter basic functionality" do
|
119
|
-
assert_respond_to(EZ::Email, :mail_port=)
|
120
|
-
end
|
121
|
-
|
122
|
-
test "mail_port method returns the expected value" do
|
123
|
-
assert_equal(25, EZ::Email.mail_port)
|
124
|
-
end
|
125
|
-
|
126
|
-
test "deliver singleton method basic functionality" do
|
127
|
-
assert_respond_to(EZ::Email, :deliver)
|
128
|
-
end
|
129
|
-
|
130
|
-
test "passing an invalid option to the constructor raises an error" do
|
131
|
-
assert_raise(ArgumentError){ EZ::Email.send(:new, {:bogus => 77}) }
|
132
|
-
end
|
133
|
-
|
134
|
-
def teardown
|
135
|
-
@to = nil
|
136
|
-
@from = nil
|
137
|
-
@subj = nil
|
138
|
-
@body = nil
|
139
|
-
@opts = nil
|
140
|
-
@email = nil
|
141
|
-
end
|
142
|
-
|
143
|
-
def self.shutdown
|
144
|
-
@@host = nil
|
145
|
-
@@login = nil
|
146
|
-
end
|
147
|
-
end
|