mailhopper 0.0.6 → 0.0.7
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.
- data/{README.rdoc → README.md} +43 -31
- data/Rakefile +4 -29
- data/lib/mailhopper/version.rb +1 -1
- metadata +49 -157
- data/test/dummy/Rakefile +0 -7
- data/test/dummy/app/assets/javascripts/application.js +0 -9
- data/test/dummy/app/assets/stylesheets/application.css +0 -7
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/mailers/sample_mailer.rb +0 -8
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/sample_mailer/hello.text.erb +0 -1
- data/test/dummy/config/application.rb +0 -42
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -27
- data/test/dummy/config/environments/production.rb +0 -51
- data/test/dummy/config/environments/test.rb +0 -39
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -10
- data/test/dummy/config/initializers/mailhopper.rb +0 -3
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -12
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -58
- data/test/dummy/config.ru +0 -4
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20110916191655_create_emails.rb +0 -29
- data/test/dummy/db/schema.rb +0 -28
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -63
- data/test/dummy/log/test.log +0 -2142
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -26
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/integration/navigation_test.rb +0 -10
- data/test/mailhopper_test.rb +0 -7
- data/test/test_helper.rb +0 -14
- data/test/unit/email_test.rb +0 -91
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
<p>We've been notified about this issue and we'll take a look at it shortly.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
data/test/mailhopper_test.rb
DELETED
data/test/test_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# Configure Rails Environment
|
2
|
-
ENV["RAILS_ENV"] = "test"
|
3
|
-
|
4
|
-
require File.expand_path("../dummy/config/environment.rb", __FILE__)
|
5
|
-
require "rails/test_help"
|
6
|
-
require "shoulda/rails"
|
7
|
-
|
8
|
-
Rails.backtrace_cleaner.remove_silencers!
|
9
|
-
|
10
|
-
# Load support files
|
11
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
12
|
-
|
13
|
-
# Run any available migration
|
14
|
-
ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
|
data/test/unit/email_test.rb
DELETED
@@ -1,91 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class EmailTest < ActiveSupport::TestCase
|
4
|
-
context "An email" do
|
5
|
-
setup do
|
6
|
-
@email = Mailhopper::Email.new
|
7
|
-
end
|
8
|
-
|
9
|
-
should "require a from address" do
|
10
|
-
assert !@email.valid?
|
11
|
-
@email.from_address = 'user@example.com'
|
12
|
-
assert @email.valid?
|
13
|
-
end
|
14
|
-
|
15
|
-
should "be generated when mail is sent to individual addresses" do
|
16
|
-
headers = {
|
17
|
-
:from => 'from@example.com',
|
18
|
-
:to => 'to@example.com',
|
19
|
-
:cc => 'cc@example.com',
|
20
|
-
:bcc => 'bcc@example.com',
|
21
|
-
:reply_to => 'reply_to@example.com',
|
22
|
-
:subject => 'Hiya!'
|
23
|
-
}
|
24
|
-
content = 'Papaya'
|
25
|
-
|
26
|
-
generate_and_verify_email(headers, content)
|
27
|
-
end
|
28
|
-
|
29
|
-
should "be generated when mail is sent to multiple addresses" do
|
30
|
-
headers = {
|
31
|
-
:from => 'from1@example.com',
|
32
|
-
:to => ['to1@example.com', 'to2@example.com'],
|
33
|
-
:cc => ['cc1@example.com', 'cc2@example.com'],
|
34
|
-
:bcc => ['bcc1@example.com', 'bcc2@example.com'],
|
35
|
-
:reply_to => 'reply_to@example.com',
|
36
|
-
:subject => 'Hiya!'
|
37
|
-
}
|
38
|
-
content = 'Papaya'
|
39
|
-
|
40
|
-
generate_and_verify_email(headers, content)
|
41
|
-
end
|
42
|
-
|
43
|
-
should "be generated when mail is sent to blank addresses" do
|
44
|
-
headers = {
|
45
|
-
:from => 'from@example.com',
|
46
|
-
:to => 'to@example.com',
|
47
|
-
:cc => nil,
|
48
|
-
:bcc => nil,
|
49
|
-
:reply_to => nil,
|
50
|
-
:subject => 'Hiya!'
|
51
|
-
}
|
52
|
-
content = 'Papaya'
|
53
|
-
|
54
|
-
generate_and_verify_email(headers, content)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def generate_and_verify_email(headers, content)
|
61
|
-
assert_equal Mailhopper::Email.count, 0
|
62
|
-
SampleMailer.hello(headers, content).deliver
|
63
|
-
assert_equal Mailhopper::Email.count, 1
|
64
|
-
|
65
|
-
email = Mailhopper::Email.first
|
66
|
-
|
67
|
-
assert_email_matches_headers(headers, email)
|
68
|
-
|
69
|
-
# Email content will include headers as well as content
|
70
|
-
assert email.content.include?(content)
|
71
|
-
|
72
|
-
assert email.sent_at.nil?
|
73
|
-
end
|
74
|
-
|
75
|
-
def assert_email_matches_headers(headers, email)
|
76
|
-
assert_address_matches_header headers[:from], email.from_address
|
77
|
-
assert_address_matches_header headers[:to], email.to_address
|
78
|
-
assert_address_matches_header headers[:cc], email.cc_address
|
79
|
-
assert_address_matches_header headers[:bcc], email.bcc_address
|
80
|
-
assert_equal headers[:reply_to], email.reply_to_address
|
81
|
-
assert_equal headers[:subject], email.subject
|
82
|
-
end
|
83
|
-
|
84
|
-
def assert_address_matches_header(header, address)
|
85
|
-
if header.kind_of? Array
|
86
|
-
assert_equal header.join(','), address
|
87
|
-
else
|
88
|
-
assert_equal header, address
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|