thincloud-postmark 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 44dd270a169b3ce0412d96a3fdb2821e0736ed4b
4
+ data.tar.gz: c5a8fd4f393ab91c65127bd892b4e735e5d651c3
5
+ SHA512:
6
+ metadata.gz: fc46af8bf170929ced2ef655a9f8fdfc24c1f3db18abddd54f67efebdcfe63f87aff8d8b6e032ed2990f4315ca5660bc2ac90fcc9a8be5ab48c0836dcc2b662d
7
+ data.tar.gz: 0c7cf9713623434a4e224a15470d5bde0cff63d9ca20cc1434494cae95eb8e63eef89c000ba3a5fc25d1ae8989120b0c04f35a199d89d38283d88cbee78d83be
data/.rubocop.yml ADDED
@@ -0,0 +1,17 @@
1
+ AllCops:
2
+ Exclude:
3
+ - "test/dummy/**/*"
4
+
5
+ Style/FileName:
6
+ Exclude:
7
+ - lib/thincloud-postmark.rb
8
+ - test/thincloud-postmark_test.rb
9
+
10
+ LineLength:
11
+ Max: 80
12
+
13
+ StringLiterals:
14
+ EnforcedStyle: double_quotes
15
+
16
+ inherit_from: test/rubocop/enabled.yml
17
+ inherit_from: test/rubocop/disabled.yml
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 1.9.3@thincloud-postmark
1
+ 2.1.2
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1.2
6
+ bundler_args: "--without local"
7
+ before_script:
8
+ - bundle exec rake app:db:setup
9
+ script:
10
+ - bundle exec rake test
11
+ - bundle exec rake cane
12
+ - bundle exec rake rubocop
13
+ notifications:
14
+ flowdock:
15
+ secure: hRaeI2fe3mbWP3BbIkurjuLLu7Lbq4ReE0Ee1i4h+drvv+pio6BItuTd7ujlhM80ZkRfpffTOZdk34fbZduf1WB+peWaYfO1f2kDPviap7wdnFRlSpJF/KaDS3/D70zA8RycSC1Oaam34cKoVg1Gmdwl0/EJAsRncfu3I+tYyiA=
16
+ env:
17
+ global:
18
+ secure: w/lOREURd+nNeOdLPffnsVT9jwvrp/ougA8a/d2EZJ48pMp1d+5bL83ZwcUfVdDoNq8YEFu+fje8La4LmkdL1GUhnHGmznkVlPnPVMMZE5fenYiJIgkyhDe4EchBXUifT0iH4HjB4SsbaehzPy78H9ceD9qtG2zyCtDhzx0ic/A=
data/Gemfile CHANGED
@@ -1,13 +1,11 @@
1
1
  source "https://rubygems.org"
2
2
 
3
+ # Declare your gem's dependencies in thincloud-resque.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
3
6
  gemspec
4
7
 
5
- # jquery-rails is used by the dummy application
6
- gem "jquery-rails"
7
-
8
8
  group :test do
9
- platforms :ruby do
10
- gem "simplecov"
11
- gem "sqlite3"
12
- end
9
+ gem "codeclimate-test-reporter", require: false
10
+ gem "simplecov"
13
11
  end
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2012 New Leaders
1
+ Copyright (c) 2012-2014 New Leaders
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,4 +1,10 @@
1
- # Thincloud::Postmark
1
+ # thincloud-postmark
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/thincloud-postmark.svg)](http://badge.fury.io/rb/thincloud-postmark)
4
+ [![Dependency Status](https://gemnasium.com/newleaders/thincloud-postmark.svg)](https://gemnasium.com/newleaders/thincloud-postmark)
5
+ [![Build Status](https://travis-ci.org/newleaders/thincloud-postmark.svg?branch=master)](https://travis-ci.org/newleaders/thincloud-postmark)
6
+ [![Code Climate](https://codeclimate.com/github/newleaders/thincloud-postmark.png)](https://codeclimate.com/github/newleaders/thincloud-postmark)
7
+ [![Test Coverage](https://codeclimate.com/github/newleaders/thincloud-postmark/coverage.png)](https://codeclimate.com/github/newleaders/thincloud-postmark)
2
8
 
3
9
  ## Description
4
10
 
@@ -18,13 +24,15 @@ This gem requires Rails 3.2+ and has been tested on the following versions:
18
24
  This gem has been tested against the following Ruby versions:
19
25
 
20
26
  * 1.9.3
27
+ * 2.0.0
28
+ * 2.1.2
21
29
 
22
30
 
23
31
  ## Installation
24
32
 
25
33
  Add this line to your application's Gemfile:
26
34
 
27
- ``` ruby
35
+ ```ruby
28
36
  gem "thincloud-postmark"
29
37
  ```
30
38
 
@@ -72,12 +80,12 @@ config.action_mailer.default_url_options = { host: "mydomain.com" }
72
80
 
73
81
  Several of the options will use environment variables when found.
74
82
 
75
- ```
76
- api_key -> ENV["POSTMARK_API_KEY"]
77
- secure -> ENV["POSTMARK_SECURE"]
78
- interceptor_to -> ENV["THINCLOUD_INTERCEPTOR_TO"]
79
- interceptor_cc -> ENV["THINCLOUD_INTERCEPTOR_CC"]
80
- interceptor_bcc -> ENV["THINCLOUD_INTERCEPTOR_BCC"]
83
+ ```ruby
84
+ api_key # ENV["POSTMARK_API_KEY"]
85
+ secure # ENV["POSTMARK_SECURE"]
86
+ interceptor_to # ENV["THINCLOUD_INTERCEPTOR_TO"]
87
+ interceptor_cc # ENV["THINCLOUD_INTERCEPTOR_CC"]
88
+ interceptor_bcc # ENV["THINCLOUD_INTERCEPTOR_BCC"]
81
89
  ```
82
90
 
83
91
  #### Configuration Block
@@ -171,6 +179,6 @@ Mail.register_interceptor(MailInterceptor) unless Rails.env.production?
171
179
 
172
180
  ## License
173
181
 
174
- * Freely distributable and licensed under the [MIT license](http://newleaders.mit-license.org/2012/license.html).
175
- * Copyright (c) 2012 New Leaders ([opensource@newleaders.com](opensource@newleaders.com))
182
+ * Freely distributable and licensed under the [MIT license](http://newleaders.mit-license.org/2012-2014/license.html).
183
+ * Copyright (c) 2012-2014 New Leaders ([opensource@newleaders.com](opensource@newleaders.com))
176
184
  * [https://newleaders.com](https://newleaders.com)
data/Rakefile CHANGED
@@ -1,8 +1,9 @@
1
- #!/usr/bin/env rake
2
-
3
1
  require "bundler/gem_tasks"
4
2
  require "rake/testtask"
5
3
 
4
+ task default: [:test, :cane, :rubocop]
5
+
6
+ desc "Run minitest suite"
6
7
  Rake::TestTask.new(:test) do |t|
7
8
  t.libs << "lib"
8
9
  t.libs << "test"
@@ -10,4 +11,16 @@ Rake::TestTask.new(:test) do |t|
10
11
  t.verbose = false
11
12
  end
12
13
 
13
- task default: :test
14
+ require "cane/rake_task"
15
+ desc "Run cane to check quality metrics"
16
+ Cane::RakeTask.new(:cane) do |cane|
17
+ cane.abc_max = 8
18
+ cane.style_measure = 80
19
+ end
20
+
21
+ require "rubocop/rake_task"
22
+ RuboCop::RakeTask.new
23
+
24
+ # dummy rails app
25
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
26
+ load "rails/tasks/engine.rake"
@@ -1,4 +1,5 @@
1
1
  module Thincloud
2
+ # Public: Postmark configuration namespace for Thincloud applications
2
3
  module Postmark
3
4
  class << self
4
5
  attr_accessor :configuration
@@ -20,20 +21,16 @@ module Thincloud
20
21
  attr_accessor :interceptor_environments
21
22
 
22
23
  def initialize
23
- api_key = ENV["POSTMARK_API_KEY"] || "POSTMARK_API_TEST"
24
- secure = ENV["POSTMARK_SECURE"] || true
25
- interceptor_to = ENV["THINCLOUD_INTERCEPTOR_TO"]
26
- interceptor_cc = ENV["THINCLOUD_INTERCEPTOR_CC"]
27
- interceptor_bcc = ENV["THINCLOUD_INTERCEPTOR_BCC"]
28
-
29
- @environments = []
30
- @api_key ||= api_key
31
- @interceptor_to ||= interceptor_to
32
- @interceptor_cc ||= interceptor_cc
33
- @interceptor_bcc ||= interceptor_bcc
24
+ @api_key ||= ENV.fetch("POSTMARK_API_KEY", "POSTMARK_API_TEST")
34
25
 
26
+ @interceptor_to ||= ENV["THINCLOUD_INTERCEPTOR_TO"]
27
+ @interceptor_cc ||= ENV["THINCLOUD_INTERCEPTOR_CC"]
28
+ @interceptor_bcc ||= ENV["THINCLOUD_INTERCEPTOR_BCC"]
29
+
30
+ @environments = []
35
31
  @interceptor_environments = []
36
- self.secure = secure
32
+
33
+ self.secure = ENV.fetch("POSTMARK_SECURE", true)
37
34
  end
38
35
 
39
36
  def secure=(s)
@@ -1,8 +1,9 @@
1
+ require "mail"
2
+
1
3
  module Thincloud
2
4
  module Postmark
3
5
  # Public: Thincloud Postmark Engine
4
6
  class Engine < ::Rails::Engine
5
-
6
7
  # convenience method for engine options / configuration
7
8
  def configuration
8
9
  Thincloud::Postmark.configuration
@@ -44,7 +45,6 @@ module Thincloud
44
45
  end
45
46
  end
46
47
  end
47
-
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -9,12 +9,12 @@ module Thincloud
9
9
  end
10
10
 
11
11
  def self.delivering_email(message)
12
- message.subject = "#{message.to} #{message.subject}"
13
- message.to = self.to
14
- message.cc = self.cc
15
- message.bcc = self.bcc
12
+ message.subject = "[#{message.to}] #{message.subject}"
13
+ message.to = to
14
+ message.cc = cc
15
+ message.bcc = bcc
16
16
  message
17
17
  end
18
18
  end
19
19
  end
20
- end
20
+ end
@@ -1,5 +1,6 @@
1
1
  module Thincloud
2
+ # Public: Postmark namespace for Thincloud applications
2
3
  module Postmark
3
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
4
5
  end
5
6
  end
@@ -6,6 +6,7 @@ require "thincloud/postmark/engine"
6
6
  require "thincloud/postmark/version"
7
7
 
8
8
  module Thincloud
9
+ # Public: Postmark namespace for Thincloud applications
9
10
  module Postmark
10
11
  end
11
12
  end
@@ -1,41 +1,45 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  describe Thincloud::Postmark::Configuration do
4
- let(:config) { Thincloud::Postmark::Configuration.new }
4
+ subject do
5
+ Thincloud::Postmark::Configuration.new
6
+ end
5
7
 
6
- it { config.must_be_kind_of Thincloud::Postmark::Configuration }
7
- it { config.must_respond_to :environments }
8
- it { config.must_respond_to :environments= }
9
- it { config.must_respond_to :api_key }
10
- it { config.must_respond_to :api_key= }
11
- it { config.must_respond_to :secure }
12
- it { config.must_respond_to :secure= }
13
- it { config.must_respond_to :interceptor_environments }
14
- it { config.must_respond_to :interceptor_to }
15
- it { config.must_respond_to :interceptor_to= }
16
- it { config.must_respond_to :interceptor_bcc }
17
- it { config.must_respond_to :interceptor_bcc= }
8
+ specify { subject.must_be_kind_of Thincloud::Postmark::Configuration }
9
+ specify { subject.must_respond_to :environments }
10
+ specify { subject.must_respond_to :environments= }
11
+ specify { subject.must_respond_to :api_key }
12
+ specify { subject.must_respond_to :api_key= }
13
+ specify { subject.must_respond_to :secure }
14
+ specify { subject.must_respond_to :secure= }
15
+ specify { subject.must_respond_to :interceptor_environments }
16
+ specify { subject.must_respond_to :interceptor_to }
17
+ specify { subject.must_respond_to :interceptor_to= }
18
+ specify { subject.must_respond_to :interceptor_bcc }
19
+ specify { subject.must_respond_to :interceptor_bcc= }
18
20
 
19
21
  describe "defaults" do
20
- it { config.environments.must_equal [] }
21
- it { config.api_key.must_equal "POSTMARK_API_TEST" }
22
- it { config.secure.must_equal true }
23
- it { ::Postmark.secure.must_equal true }
24
- it { config.interceptor_environments.must_equal [] }
25
- it { config.interceptor_to.must_be_nil }
26
- it { config.interceptor_cc.must_be_nil }
27
- it { config.interceptor_bcc.must_be_nil }
22
+ specify { subject.environments.must_equal [] }
23
+ specify { subject.api_key.must_equal "POSTMARK_API_TEST" }
24
+ specify { subject.secure.must_equal true }
25
+ specify { ::Postmark.secure.must_equal true }
26
+ specify { subject.interceptor_environments.must_equal [] }
27
+ specify { subject.interceptor_to.must_be_nil }
28
+ specify { subject.interceptor_cc.must_be_nil }
29
+ specify { subject.interceptor_bcc.must_be_nil }
28
30
  end
29
31
 
30
32
  describe "changes Postmark secure setting" do
31
33
  before do
32
34
  @original_setting = ::Postmark.secure
33
- config.secure = false
35
+ subject.secure = false
34
36
  end
35
37
 
36
- after { ::Postmark.secure = @original_setting }
38
+ after do
39
+ ::Postmark.secure = @original_setting
40
+ end
37
41
 
38
- it { config.secure.must_equal false }
39
- it { ::Postmark.secure.must_equal false }
42
+ specify { subject.secure.must_equal false }
43
+ specify { ::Postmark.secure.must_equal false }
40
44
  end
41
45
  end
@@ -0,0 +1,16 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 0) do
15
+
16
+ end
@@ -1,11 +1,13 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  describe Dummy::Application.config do
4
- let(:config) { Dummy::Application.config.thincloud.postmark }
4
+ let(:config) do
5
+ Dummy::Application.config.thincloud.postmark
6
+ end
5
7
 
6
8
  # defaults
7
- it { config.must_be_kind_of Thincloud::Postmark::Configuration }
8
- it { config.api_key.must_equal "INITIALIZER" }
9
+ specify { config.must_be_kind_of Thincloud::Postmark::Configuration }
10
+ specify { config.api_key.must_equal "INITIALIZER" }
9
11
 
10
12
  describe "with configure block" do
11
13
  before do
@@ -14,7 +16,7 @@ describe Dummy::Application.config do
14
16
  end
15
17
  end
16
18
 
17
- it { config.api_key.must_equal "abc123" }
19
+ specify { config.api_key.must_equal "abc123" }
18
20
  end
19
21
 
20
22
  describe "changes Postmark secure setting" do
@@ -26,25 +28,22 @@ describe Dummy::Application.config do
26
28
  end
27
29
  end
28
30
 
29
- after { config.secure = @original_setting }
30
-
31
- it { config.secure.must_equal false }
32
- it { ::Postmark.secure.must_equal false }
33
- end
34
-
35
- describe "updates Rails application configuration" do
36
- let(:app_config) { Dummy::Application.config.action_mailer }
37
- let(:settings) { { api_key: "INITIALIZER" } }
31
+ after do
32
+ config.secure = @original_setting
33
+ end
38
34
 
39
- it { app_config.delivery_method.must_equal :postmark }
40
- it { app_config.postmark_settings.must_equal settings }
35
+ specify { config.secure.must_equal false }
36
+ specify { ::Postmark.secure.must_equal false }
41
37
  end
42
38
 
43
- describe "updates ActionMailer configuration" do
44
- let(:base_config) { ActionMailer::Base }
45
- let(:settings) { { api_key: "INITIALIZER" } }
39
+ describe "configuration updates" do
40
+ let(:settings) do
41
+ { api_key: "INITIALIZER" }
42
+ end
46
43
 
47
- it { base_config.delivery_method.must_equal :postmark }
48
- it { base_config.postmark_settings.must_equal settings }
44
+ [Dummy::Application.config.action_mailer, ActionMailer::Base].each do |conf|
45
+ specify { conf.delivery_method.must_equal :postmark }
46
+ specify { conf.postmark_settings.must_equal settings }
47
+ end
49
48
  end
50
49
  end
@@ -1,13 +1,18 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  describe Thincloud::Postmark::Interceptor do
4
- let(:interceptor) { Thincloud::Postmark::Interceptor }
5
- let(:interceptors) { ::Mail.class_variable_get(:@@delivery_interceptors) }
4
+ let(:interceptor) do
5
+ Thincloud::Postmark::Interceptor
6
+ end
7
+
8
+ let(:interceptors) do
9
+ ::Mail.class_variable_get(:@@delivery_interceptors)
10
+ end
6
11
 
7
12
  describe "after Rails config" do
8
- it { interceptors.must_include Thincloud::Postmark::Interceptor }
9
- it { interceptor.to.must_equal "marshmellowman@staypuft.com" }
10
- it { interceptor.cc.must_be_nil }
11
- it { interceptor.bcc.must_be_nil }
13
+ specify { interceptors.must_include Thincloud::Postmark::Interceptor }
14
+ specify { interceptor.to.must_equal "marshmellowman@staypuft.com" }
15
+ specify { interceptor.cc.must_be_nil }
16
+ specify { interceptor.bcc.must_be_nil }
12
17
  end
13
18
  end
@@ -1,49 +1,41 @@
1
1
  require "minitest_helper"
2
2
 
3
3
  describe Thincloud::Postmark::Interceptor do
4
- let(:mail) { OpenStruct.new(to: "rpeck@epa.gov", subject: "Subject") }
5
- let(:interceptor) { Thincloud::Postmark::Interceptor }
4
+ let(:mail) do
5
+ OpenStruct.new(to: "rpeck@epa.gov", subject: "Subject")
6
+ end
7
+
8
+ subject do
9
+ Thincloud::Postmark::Interceptor
10
+ end
6
11
 
7
- it { interceptor.must_respond_to(:to) }
8
- it { interceptor.must_respond_to(:to=) }
9
- it { interceptor.must_respond_to(:cc) }
10
- it { interceptor.must_respond_to(:cc=) }
11
- it { interceptor.must_respond_to(:bcc) }
12
- it { interceptor.must_respond_to(:bcc=) }
13
- it { interceptor.must_respond_to(:delivering_email) }
12
+ specify { subject.must_respond_to(:to) }
13
+ specify { subject.must_respond_to(:to=) }
14
+ specify { subject.must_respond_to(:cc) }
15
+ specify { subject.must_respond_to(:cc=) }
16
+ specify { subject.must_respond_to(:bcc) }
17
+ specify { subject.must_respond_to(:bcc=) }
18
+ specify { subject.must_respond_to(:delivering_email) }
14
19
 
15
20
  describe "munges the subject" do
16
21
  before do
17
- @msg = interceptor.delivering_email(mail)
22
+ @msg = subject.delivering_email(mail)
18
23
  end
19
24
 
20
- it { @msg.subject.must_equal "rpeck@epa.gov Subject" }
25
+ specify { @msg.subject.must_equal "[rpeck@epa.gov] Subject" }
21
26
  end
22
27
 
23
28
  describe "sets email `to`" do
24
29
  before do
25
- interceptor.to = "egon@ghostbusters.com"
26
- @msg = interceptor.delivering_email(mail)
27
- end
28
-
29
- it { @msg.to.must_equal "egon@ghostbusters.com" }
30
- end
31
-
32
- describe "sets email `cc`" do
33
- before do
34
- interceptor.cc = "venkman@ghostbusters.com"
35
- @msg = interceptor.delivering_email(mail)
36
- end
30
+ subject.to = "egon@ghostbusters.com"
31
+ subject.cc = "venkman@ghostbusters.com"
32
+ subject.bcc = "stantz@ghostbusters.com"
37
33
 
38
- it { @msg.cc.must_equal "venkman@ghostbusters.com" }
39
- end
40
-
41
- describe "sets email `bcc`" do
42
- before do
43
- interceptor.bcc = "stantz@ghostbusters.com"
44
- @msg = interceptor.delivering_email(mail)
34
+ @msg = subject.delivering_email(mail)
45
35
  end
46
36
 
47
- it { @msg.bcc.must_equal "stantz@ghostbusters.com" }
37
+ specify { @msg.to.must_equal "egon@ghostbusters.com" }
38
+ specify { @msg.cc.must_equal "venkman@ghostbusters.com" }
39
+ specify { @msg.bcc.must_equal "stantz@ghostbusters.com" }
48
40
  end
49
- end
41
+ end
@@ -1,13 +1,10 @@
1
- if RUBY_ENGINE == "ruby"
2
- begin
3
- require "simplecov"
4
- SimpleCov.add_filter "test"
5
- SimpleCov.add_filter "config"
6
- SimpleCov.command_name "MiniTest"
7
- SimpleCov.start
8
- rescue LoadError
9
- warn "unable to load SimpleCov"
10
- end
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
4
+ require "simplecov"
5
+ SimpleCov.start do
6
+ add_filter { |src| src.filename =~ /bundle|test|config|vendor/ }
7
+ command_name "Minitest"
11
8
  end
12
9
 
13
10
  ENV["RAILS_ENV"] = "test"
@@ -15,11 +12,4 @@ ENV["RAILS_ENV"] = "test"
15
12
  require File.expand_path("../dummy/config/environment", __FILE__)
16
13
 
17
14
  require "minitest/autorun"
18
- require "minitest/rails"
19
15
  require "minitest/pride"
20
- require "minitest-rails-shoulda"
21
-
22
- Rails.backtrace_cleaner.remove_silencers!
23
-
24
- # Load support files
25
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
@@ -0,0 +1,25 @@
1
+ Encoding:
2
+ Description: 'Use UTF-8 as the source file encoding.'
3
+ Enabled: false
4
+
5
+ SymbolArray:
6
+ Description: 'Use %i or %I for arrays of symbols.'
7
+ Enabled: false
8
+
9
+ ##################### Rails ##################################
10
+
11
+ DefaultScope:
12
+ Description: 'Checks if the argument passed to default_scope is a block.'
13
+ Enabled: false
14
+
15
+ HasAndBelongsToMany:
16
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
17
+ Enabled: false
18
+
19
+ Output:
20
+ Description: 'Checks for calls to puts, print, etc.'
21
+ Enabled: false
22
+
23
+ Validation:
24
+ Description: 'Use sexy validations.'
25
+ Enabled: false