multiple_mailers 1.1.1 → 1.2.0
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 +7 -0
- data/.rspec +2 -0
- data/lib/multiple_mailers.rb +0 -1
- data/lib/multiple_mailers/configuration.rb +6 -4
- data/lib/multiple_mailers/version.rb +1 -1
- data/spec/multiple_mailers/configuration_spec.rb +52 -25
- data/spec/multiple_mailers_spec.rb +56 -20
- data/spec/spec_helper.rb +2 -0
- metadata +15 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5cc97be1ab0cb6aa48b7970ec957827d7f7ce0ed
|
4
|
+
data.tar.gz: 52ddedcd8e5e49aa2e6f5afd1d731465f48c5e7d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: cd03f57b46091312083c2a52237f936dfa783d146e3b7a832bd30d0ceb97a92c66b42f0a94d6af29dea0f085d0e1b7f3eadd93f4eeb484802acd27e32b7d19c5
|
7
|
+
data.tar.gz: ea7606d8005c61b546bf5a0975a025697ec6052b32dc55d482958d22e27204cfecccd36b36ca9d078df24189c4dd16fd2e09203c19a6e7eae8bd63cdc271781d
|
data/.rspec
ADDED
data/lib/multiple_mailers.rb
CHANGED
@@ -3,12 +3,14 @@ require "yaml"
|
|
3
3
|
module MultipleMailers
|
4
4
|
class Configuration
|
5
5
|
class <<self
|
6
|
-
def
|
7
|
-
|
6
|
+
def get(name)
|
7
|
+
configuration[name]
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
private
|
11
|
+
|
12
|
+
def configuration
|
13
|
+
@configuration ||= YAML.load_file(Rails.root.join("config/mailers.yml"))[Rails.env]
|
12
14
|
end
|
13
15
|
end
|
14
16
|
end
|
@@ -2,34 +2,61 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module MultipleMailers
|
4
4
|
describe Configuration do
|
5
|
-
|
6
|
-
|
7
|
-
Configuration.
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
describe ".get" do
|
6
|
+
context "notification" do
|
7
|
+
let(:config) { Configuration.get("notification") }
|
8
|
+
|
9
|
+
it "gets address with smtp.gmail.com" do
|
10
|
+
expect(config["address"]).to eq "smtp.gmail.com"
|
11
|
+
end
|
12
|
+
|
13
|
+
it "get port with 587" do
|
14
|
+
expect(config["port"]).to eq 587
|
15
|
+
end
|
16
|
+
|
17
|
+
it "gets domain with railsbp.com" do
|
18
|
+
expect(config["domain"]).to eq "railsbp.com"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "gets authentication with plain" do
|
22
|
+
expect(config["authentication"]).to eq "plain"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "gets user_name with notification@railsbp.com" do
|
26
|
+
expect(config["user_name"]).to eq "notification@railsbp.com"
|
27
|
+
end
|
11
28
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
it "should get configuration for notification" do
|
16
|
-
config = Configuration.get("notification")
|
17
|
-
config["address"].should == "smtp.gmail.com"
|
18
|
-
config["port"].should == 587
|
19
|
-
config["domain"].should == "railsbp.com"
|
20
|
-
config["authentication"].should == "plain"
|
21
|
-
config["user_name"].should == "notification@railsbp.com"
|
22
|
-
config["password"].should == "password"
|
29
|
+
it "gets password with password" do
|
30
|
+
expect(config["password"]).to eq "password"
|
31
|
+
end
|
23
32
|
end
|
24
33
|
|
25
|
-
|
26
|
-
config
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
34
|
+
context "exception_notifier" do
|
35
|
+
let(:config) { Configuration.get("exception.notifier") }
|
36
|
+
|
37
|
+
it "gets address with smtp.gmail.com" do
|
38
|
+
expect(config["address"]).to eq "smtp.gmail.com"
|
39
|
+
end
|
40
|
+
|
41
|
+
it "get port with 587" do
|
42
|
+
expect(config["port"]).to eq 587
|
43
|
+
end
|
44
|
+
|
45
|
+
it "gets domain with railsbp.com" do
|
46
|
+
expect(config["domain"]).to eq "railsbp.com"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "gets authentication with plain" do
|
50
|
+
expect(config["authentication"]).to eq "plain"
|
51
|
+
end
|
52
|
+
|
53
|
+
it "gets user_name with exception.notifier@railsbp.com" do
|
54
|
+
expect(config["user_name"]).to eq "exception.notifier@railsbp.com"
|
55
|
+
end
|
56
|
+
|
57
|
+
it "gets password with password" do
|
58
|
+
expect(config["password"]).to eq "password"
|
59
|
+
end
|
33
60
|
end
|
34
61
|
end
|
35
62
|
end
|
@@ -1,28 +1,64 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe MultipleMailers do
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
describe ".mail_account" do
|
5
|
+
context "default" do
|
6
|
+
let(:config) { ActionMailer::Base.smtp_settings }
|
7
|
+
|
8
|
+
it "gets address with smtp.gmail.com" do
|
9
|
+
expect(config[:address]).to eq "smtp.gmail.com"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "get port with 587" do
|
13
|
+
expect(config[:port]).to eq 587
|
14
|
+
end
|
15
|
+
|
16
|
+
it "gets domain with railsbp.com" do
|
17
|
+
expect(config[:domain]).to eq "railsbp.com"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "gets authentication with plain" do
|
21
|
+
expect(config[:authentication]).to eq "plain"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "gets user_name with nil" do
|
25
|
+
expect(config[:user_name]).to be_nil
|
26
|
+
end
|
27
|
+
|
28
|
+
it "gets password with nil" do
|
29
|
+
expect(config[:password]).to be_nil
|
30
|
+
end
|
15
31
|
end
|
16
32
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
33
|
+
context "notification" do
|
34
|
+
let(:config) {
|
35
|
+
ActionMailer::Base.class_eval { mailer_account "notification" }
|
36
|
+
ActionMailer::Base.smtp_settings
|
37
|
+
}
|
38
|
+
|
39
|
+
it "gets address with smtp.gmail.com" do
|
40
|
+
expect(config[:address]).to eq "smtp.gmail.com"
|
41
|
+
end
|
42
|
+
|
43
|
+
it "get port with 587" do
|
44
|
+
expect(config[:port]).to eq 587
|
45
|
+
end
|
46
|
+
|
47
|
+
it "gets domain with railsbp.com" do
|
48
|
+
expect(config[:domain]).to eq "railsbp.com"
|
49
|
+
end
|
50
|
+
|
51
|
+
it "gets authentication with plain" do
|
52
|
+
expect(config[:authentication]).to eq "plain"
|
53
|
+
end
|
54
|
+
|
55
|
+
it "gets user_name with notification@railsbp.com" do
|
56
|
+
expect(config[:user_name]).to eq "notification@railsbp.com"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "gets password with password" do
|
60
|
+
expect(config[:password]).to eq "password"
|
61
|
+
end
|
26
62
|
end
|
27
63
|
end
|
28
64
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multiple_mailers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Richard Huang
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: actionmailer
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
description: extend actionmailer to allow one smtp account per mailer class
|
26
28
|
email:
|
27
29
|
- flyerhzm@gmail.com
|
@@ -30,6 +32,7 @@ extensions: []
|
|
30
32
|
extra_rdoc_files: []
|
31
33
|
files:
|
32
34
|
- .gitignore
|
35
|
+
- .rspec
|
33
36
|
- Gemfile
|
34
37
|
- LICENSE
|
35
38
|
- README.md
|
@@ -44,27 +47,26 @@ files:
|
|
44
47
|
- spec/spec_helper.rb
|
45
48
|
homepage: https://github.com/flyerhzm/multiple_mailers
|
46
49
|
licenses: []
|
50
|
+
metadata: {}
|
47
51
|
post_install_message:
|
48
52
|
rdoc_options: []
|
49
53
|
require_paths:
|
50
54
|
- lib
|
51
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
56
|
requirements:
|
54
|
-
- -
|
57
|
+
- - '>='
|
55
58
|
- !ruby/object:Gem::Version
|
56
59
|
version: '0'
|
57
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
61
|
requirements:
|
60
|
-
- -
|
62
|
+
- - '>='
|
61
63
|
- !ruby/object:Gem::Version
|
62
64
|
version: '0'
|
63
65
|
requirements: []
|
64
66
|
rubyforge_project:
|
65
|
-
rubygems_version:
|
67
|
+
rubygems_version: 2.0.3
|
66
68
|
signing_key:
|
67
|
-
specification_version:
|
69
|
+
specification_version: 4
|
68
70
|
summary: extend actionmailer to allow one smtp account per mailer class
|
69
71
|
test_files:
|
70
72
|
- spec/config/mailers.yml
|