active_wrapper 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -1
- data/gemspec.rb +1 -1
- data/lib/active_wrapper/mail.rb +11 -13
- data/spec/active_wrapper/mail_spec.rb +35 -0
- data/spec/example_project/config/mail.yml +16 -0
- metadata +4 -2
data/README.markdown
CHANGED
data/gemspec.rb
CHANGED
data/lib/active_wrapper/mail.rb
CHANGED
@@ -13,21 +13,19 @@ module ActiveWrapper
|
|
13
13
|
|
14
14
|
path = "#{base}/config/mail.yml"
|
15
15
|
|
16
|
+
if File.exists?(path)
|
17
|
+
yaml = YAML::load(File.open(path))
|
18
|
+
if yaml && yaml[@env]
|
19
|
+
yaml = yaml[@env].to_options
|
20
|
+
@config[:imap] = yaml[:imap].to_options if yaml[:imap]
|
21
|
+
@config[:smtp] = yaml[:smtp].to_options if yaml[:smtp]
|
22
|
+
end
|
23
|
+
end
|
16
24
|
if @env == 'test'
|
17
25
|
ActionMailer::Base.delivery_method = :test
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
yaml = YAML::load(File.open(path))
|
22
|
-
if yaml && yaml = yaml[@env].to_options
|
23
|
-
@config[:imap] = yaml[:imap].to_options unless @config[:imap]
|
24
|
-
@config[:smtp] = yaml[:smtp].to_options unless @config[:smtp]
|
25
|
-
end
|
26
|
-
end
|
27
|
-
if @config[:smtp]
|
28
|
-
ActionMailer::Base.delivery_method = :smtp
|
29
|
-
ActionMailer::Base.smtp_settings = @config[:smtp]
|
30
|
-
end
|
26
|
+
elsif @config[:smtp]
|
27
|
+
ActionMailer::Base.delivery_method = :smtp
|
28
|
+
ActionMailer::Base.smtp_settings = @config[:smtp]
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe ActiveWrapper::Db do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
$db, $log, $mail = ActiveWrapper.setup(
|
7
|
+
:base => SPEC + '/example_project',
|
8
|
+
:env => 'test'
|
9
|
+
)
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should set instance variables" do
|
13
|
+
$mail.base.should == '/Users/winton/Sites/repositories/active/active_wrapper/spec/example_project'
|
14
|
+
$mail.config.should == {
|
15
|
+
:smtp => {
|
16
|
+
:address => "smtp.gmail.com",
|
17
|
+
:authentication => :plain,
|
18
|
+
:domain => "mydomain.com",
|
19
|
+
:password => "password",
|
20
|
+
:port => 587,
|
21
|
+
:enable_starttls_auto => true,
|
22
|
+
:user_name => "test@mydomain.com"
|
23
|
+
},
|
24
|
+
:imap => {
|
25
|
+
:password => "password",
|
26
|
+
:port => 993,
|
27
|
+
:server => "imap.gmail.com",
|
28
|
+
:ssl => true,
|
29
|
+
:use_login => true,
|
30
|
+
:username => "test@mydomain.com"
|
31
|
+
}
|
32
|
+
}
|
33
|
+
$mail.env.should == 'test'
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
test:
|
2
|
+
imap:
|
3
|
+
password: password
|
4
|
+
port: 993
|
5
|
+
server: imap.gmail.com
|
6
|
+
ssl: true
|
7
|
+
use_login: true
|
8
|
+
username: test@mydomain.com
|
9
|
+
smtp:
|
10
|
+
address: smtp.gmail.com
|
11
|
+
authentication: :plain
|
12
|
+
domain: mydomain.com
|
13
|
+
password: password
|
14
|
+
port: 587
|
15
|
+
enable_starttls_auto: true
|
16
|
+
user_name: test@mydomain.com
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Winton Welsh
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-18 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -53,7 +53,9 @@ files:
|
|
53
53
|
- resources/migration.template
|
54
54
|
- spec/active_wrapper/db_spec.rb
|
55
55
|
- spec/active_wrapper/log_spec.rb
|
56
|
+
- spec/active_wrapper/mail_spec.rb
|
56
57
|
- spec/example_project/config/database.yml
|
58
|
+
- spec/example_project/config/mail.yml
|
57
59
|
- spec/example_project/db/migrate/001_test.rb
|
58
60
|
- spec/example_project/Rakefile
|
59
61
|
- spec/spec.opts
|