mail_envi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/mail_envi.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'rails/railtie'
1
+ require 'rails'
2
2
  require 'mail'
3
3
  require 'mail_envi/config'
4
4
 
@@ -21,11 +21,8 @@ module MailEnvi
21
21
  end
22
22
 
23
23
  def self.config &block
24
- if block_given?
25
- @config = MailEnvi::Config.new &block
26
- else
27
- @config ||= MailEnvi::Config.new
28
- end
24
+ @config = MailEnvi::Config.new &block if block_given?
25
+ @config || MailEnvi::Config.new
29
26
  end
30
27
 
31
28
 
data/mail_envi.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{mail_envi}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Yung Hwa Kwon}]
12
- s.date = %q{2011-09-13}
12
+ s.date = %q{2011-09-14}
13
13
  s.description = %q{}
14
14
  s.email = %q{yung.kwon@damncarousel.com}
15
15
  s.extra_rdoc_files = [
@@ -1,6 +1,6 @@
1
1
  require 'test_helper'
2
2
 
3
- require File.expand_path("../../dummy/config/environment.rb", __FILE__)
3
+ # require File.expand_path("../../dummy/config/environment.rb", __FILE__)
4
4
 
5
5
  class TestUserMailer < ActionMailer::TestCase
6
6
  context "when configured with MailEnvi" do
@@ -8,6 +8,8 @@ class TestUserMailer < ActionMailer::TestCase
8
8
  mock(user = Object.new)
9
9
  stub(user).email {'user@company.com'}
10
10
 
11
+ Dummy::Application.initialize!
12
+
11
13
  email = UserMailer.registration_complete(user).deliver
12
14
  assert (not ActionMailer::Base.deliveries.empty?)
13
15
  assert_equal ['configured@company.com'], email.to
data/test/test_helper.rb CHANGED
@@ -5,6 +5,7 @@ ENV["RAILS_ENV"] = "test"
5
5
 
6
6
  # load the dummy app
7
7
  # require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
+ require File.expand_path("../dummy/config/application.rb", __FILE__)
8
9
 
9
10
 
10
11
  begin
@@ -1,7 +1,7 @@
1
1
  require 'test_helper'
2
2
 
3
- $:.unshift File.expand_path('../../lib', __FILE__)
4
- require 'mail_envi'
3
+ # $:.unshift File.expand_path('../../lib', __FILE__)
4
+ # require 'mail_envi'
5
5
 
6
6
  class TestMailEnvi < ActiveSupport::TestCase
7
7
  include ActiveSupport::Testing::Isolation
@@ -10,27 +10,34 @@ class TestMailEnvi < ActiveSupport::TestCase
10
10
  MailEnvi::Rails::Railtie.new
11
11
  end
12
12
 
13
+ context "when running these tests" do
14
+ should "run faster than it does now" do
15
+ skip
16
+ end
17
+ end
18
+
13
19
  context "in a production environment" do
14
20
  setup { stub(MailEnvi).ronment {'production'} }
15
21
 
16
22
  should "not register the Mail interceptor" do
17
23
  dont_allow(::Mail).register_interceptor(anything)
18
- mail_envi.run_initializers
24
+ # mail_envi.run_initializers
25
+ Dummy::Application.initialize!
19
26
  end
20
27
  end
21
28
 
22
29
  context "in a development or included environments" do
23
30
  should "register the default Mail interceptor" do
24
- skip "This needs fixing"
25
- MailEnvi.config do |config|
31
+ mail_envi_config = MailEnvi.config do |config|
26
32
  config.include_environments [:test, :staging, :beta]
27
33
  end
28
34
 
29
- %w(development test staging beta).each do |v|
30
- stub(MailEnvi).ronment {v}
31
- mock(::Mail).register_interceptor(MailEnvi::DefaultInterceptor)
32
- mail_envi.run_initializers
33
- end
35
+ stub(MailEnvi).ronment {'staging'}
36
+ stub(MailEnvi).config {mail_envi_config}
37
+
38
+ mock(::Mail).register_interceptor(MailEnvi::DefaultInterceptor)
39
+ # mail_envi.run_initializers # does not execute after_initialize
40
+ Dummy::Application.initialize!
34
41
  end
35
42
  end
36
43
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mail_envi
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.1
5
+ version: 0.1.2
6
6
  platform: ruby
7
7
  authors:
8
8
  - Yung Hwa Kwon
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-09-13 00:00:00 Z
13
+ date: 2011-09-14 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -163,7 +163,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
- hash: -1327940184685094388
166
+ hash: -4161991172690583465
167
167
  segments:
168
168
  - 0
169
169
  version: "0"