goatmail 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +23 -0
- data/.travis.yml +23 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +22 -0
- data/README.md +95 -0
- data/Rakefile +11 -0
- data/goatmail.gemspec +36 -0
- data/lib/goatmail.rb +20 -0
- data/lib/goatmail/app.rb +68 -0
- data/lib/goatmail/assets/fonts/glyphicons-halflings-regular.eot +0 -0
- data/lib/goatmail/assets/fonts/glyphicons-halflings-regular.svg +229 -0
- data/lib/goatmail/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/lib/goatmail/assets/fonts/glyphicons-halflings-regular.woff +0 -0
- data/lib/goatmail/assets/javascripts/application.js +39 -0
- data/lib/goatmail/assets/javascripts/bootstrap.min.js +6 -0
- data/lib/goatmail/assets/javascripts/jquery.min.js +4 -0
- data/lib/goatmail/assets/javascripts/jquery.searcher.min.js +5 -0
- data/lib/goatmail/assets/stylesheets/application.css +138 -0
- data/lib/goatmail/assets/stylesheets/bootstrap.min.css +7 -0
- data/lib/goatmail/delivery_method.rb +23 -0
- data/lib/goatmail/message.rb +61 -0
- data/lib/goatmail/railtie.rb +9 -0
- data/lib/goatmail/version.rb +8 -0
- data/lib/goatmail/views/index.erb +54 -0
- data/lib/goatmail/views/layout.erb +18 -0
- data/test/helper.rb +48 -0
- data/test/test_app.rb +38 -0
- data/test/test_delivery_method.rb +44 -0
- data/test/test_message.rb +46 -0
- metadata +184 -0
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
describe Goatmail::DeliveryMethod do
|
4
|
+
|
5
|
+
let(:plain_file) { Dir["#{test_location}/*/plain.html"].first }
|
6
|
+
let(:meta_file) { Dir["#{test_location}/*/meta"].first }
|
7
|
+
let(:meta) { Marshal.load(File.read(meta_file)) }
|
8
|
+
|
9
|
+
it 'raises an exception if no location passed' do
|
10
|
+
Goatmail.location = nil
|
11
|
+
assert_raises(Goatmail::DeliveryMethod::InvalidOption) { Goatmail::DeliveryMethod.new }
|
12
|
+
Goatmail.location = test_location
|
13
|
+
Goatmail::DeliveryMethod.new
|
14
|
+
end
|
15
|
+
|
16
|
+
describe 'using deliver! method' do
|
17
|
+
before do
|
18
|
+
Mail.new {
|
19
|
+
from 'foo@example.com'
|
20
|
+
to 'bar@example.com'
|
21
|
+
subject 'Hello'
|
22
|
+
body 'World!'
|
23
|
+
}.deliver!
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'creates plain html document' do
|
27
|
+
assert File.exist?(plain_file)
|
28
|
+
end
|
29
|
+
it 'creates meta data file' do
|
30
|
+
assert File.exist?(meta_file)
|
31
|
+
end
|
32
|
+
it 'saves a Subject into the meta data file' do
|
33
|
+
assert meta[:subject], 'Hello'
|
34
|
+
end
|
35
|
+
it 'saves a To into the meta data file' do
|
36
|
+
assert meta[:to], 'foo@example.com'
|
37
|
+
end
|
38
|
+
it 'saves a From into the meta data file' do
|
39
|
+
assert meta[:from], 'bar@example.com'
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/helper')
|
2
|
+
|
3
|
+
describe Goatmail::Message do
|
4
|
+
|
5
|
+
before do
|
6
|
+
2.times do
|
7
|
+
Mail.new {
|
8
|
+
from 'foo@example.com'
|
9
|
+
to 'bar@example.com'
|
10
|
+
subject 'Hello'
|
11
|
+
body 'World!'
|
12
|
+
}.deliver!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
describe '.location' do
|
17
|
+
it 'return Goatmail#location' do
|
18
|
+
assert_equal Goatmail::Message.location, Goatmail.location
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.load_all' do
|
23
|
+
subject { Goatmail::Message.load_all }
|
24
|
+
it 'returns a list of messages' do
|
25
|
+
assert_equal subject.count, 2
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '.find' do
|
30
|
+
let(:id) { '1111111111_1111111' }
|
31
|
+
subject { Goatmail::Message.find id }
|
32
|
+
it 'returns a message with id set' do
|
33
|
+
assert_equal subject.id, id
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.bulk_delete' do
|
38
|
+
it 'removes all specified messages' do
|
39
|
+
ids = Goatmail::Message.load_all.map(&:id)
|
40
|
+
assert_equal ids.count, 2
|
41
|
+
Goatmail::Message.bulk_delete(ids)
|
42
|
+
assert_equal Goatmail::Message.load_all.count, 0
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,184 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: goatmail
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takeshi Yabe
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2014-12-29 00:00:00 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: letter_opener
|
16
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- &id002
|
19
|
+
- ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: "0"
|
22
|
+
requirement: *id001
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: sinatra
|
27
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- *id002
|
30
|
+
requirement: *id003
|
31
|
+
type: :runtime
|
32
|
+
prerelease: false
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ~>
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: "1.6"
|
40
|
+
requirement: *id004
|
41
|
+
type: :development
|
42
|
+
prerelease: false
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rake
|
45
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- *id002
|
48
|
+
requirement: *id005
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: minitest
|
53
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - ~>
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: "5.3"
|
58
|
+
requirement: *id006
|
59
|
+
type: :development
|
60
|
+
prerelease: false
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: minitest-power_assert
|
63
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- *id002
|
66
|
+
requirement: *id007
|
67
|
+
type: :development
|
68
|
+
prerelease: false
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-test
|
71
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- *id002
|
74
|
+
requirement: *id008
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: mail
|
79
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- *id002
|
82
|
+
requirement: *id009
|
83
|
+
type: :development
|
84
|
+
prerelease: false
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: capybara
|
87
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- *id002
|
90
|
+
requirement: *id010
|
91
|
+
type: :development
|
92
|
+
prerelease: false
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: capybara-webkit
|
95
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- *id002
|
98
|
+
requirement: *id011
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: capybara_minitest_spec
|
103
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- *id002
|
106
|
+
requirement: *id012
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: poltergeist
|
111
|
+
version_requirements: &id013 !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- *id002
|
114
|
+
requirement: *id013
|
115
|
+
type: :development
|
116
|
+
prerelease: false
|
117
|
+
description: a Sinatra Application to browse the email sent by letter_opener
|
118
|
+
email: tyabe@nilidea.com
|
119
|
+
executables: []
|
120
|
+
|
121
|
+
extensions: []
|
122
|
+
|
123
|
+
extra_rdoc_files: []
|
124
|
+
|
125
|
+
files:
|
126
|
+
- .gitignore
|
127
|
+
- .travis.yml
|
128
|
+
- Gemfile
|
129
|
+
- LICENSE.txt
|
130
|
+
- README.md
|
131
|
+
- Rakefile
|
132
|
+
- goatmail.gemspec
|
133
|
+
- lib/goatmail.rb
|
134
|
+
- lib/goatmail/app.rb
|
135
|
+
- lib/goatmail/assets/fonts/glyphicons-halflings-regular.eot
|
136
|
+
- lib/goatmail/assets/fonts/glyphicons-halflings-regular.svg
|
137
|
+
- lib/goatmail/assets/fonts/glyphicons-halflings-regular.ttf
|
138
|
+
- lib/goatmail/assets/fonts/glyphicons-halflings-regular.woff
|
139
|
+
- lib/goatmail/assets/javascripts/application.js
|
140
|
+
- lib/goatmail/assets/javascripts/bootstrap.min.js
|
141
|
+
- lib/goatmail/assets/javascripts/jquery.min.js
|
142
|
+
- lib/goatmail/assets/javascripts/jquery.searcher.min.js
|
143
|
+
- lib/goatmail/assets/stylesheets/application.css
|
144
|
+
- lib/goatmail/assets/stylesheets/bootstrap.min.css
|
145
|
+
- lib/goatmail/delivery_method.rb
|
146
|
+
- lib/goatmail/message.rb
|
147
|
+
- lib/goatmail/railtie.rb
|
148
|
+
- lib/goatmail/version.rb
|
149
|
+
- lib/goatmail/views/index.erb
|
150
|
+
- lib/goatmail/views/layout.erb
|
151
|
+
- test/helper.rb
|
152
|
+
- test/test_app.rb
|
153
|
+
- test/test_delivery_method.rb
|
154
|
+
- test/test_message.rb
|
155
|
+
homepage: http://github.com/tyabe/goatmail
|
156
|
+
licenses:
|
157
|
+
- MIT
|
158
|
+
metadata: {}
|
159
|
+
|
160
|
+
post_install_message:
|
161
|
+
rdoc_options: []
|
162
|
+
|
163
|
+
require_paths:
|
164
|
+
- lib
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - ">="
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: 2.0.0
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- *id002
|
173
|
+
requirements: []
|
174
|
+
|
175
|
+
rubyforge_project:
|
176
|
+
rubygems_version: 2.2.2
|
177
|
+
signing_key:
|
178
|
+
specification_version: 4
|
179
|
+
summary: Sinatra-based letter_opener web interface
|
180
|
+
test_files:
|
181
|
+
- test/helper.rb
|
182
|
+
- test/test_app.rb
|
183
|
+
- test/test_delivery_method.rb
|
184
|
+
- test/test_message.rb
|