letter_opener_web 1.2.0 → 1.2.1
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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -2
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +74 -69
- data/README.md +3 -15
- data/app/controllers/letter_opener_web/letters_controller.rb +4 -4
- data/app/views/letter_opener_web/letters/index.html.erb +8 -8
- data/letter_opener_web.gemspec +1 -1
- data/lib/letter_opener_web/version.rb +1 -1
- data/spec/controllers/letter_opener_web/letters_controller_spec.rb +3 -3
- data/spec/models/letter_opener_web/letter_spec.rb +3 -3
- data/spec/spec_helper.rb +1 -1
- metadata +4 -12
- data/demo/.gitignore +0 -2
- data/demo/Gemfile +0 -14
- data/demo/Gemfile.lock +0 -125
- data/demo/application_controller.rb +0 -28
- data/demo/boot.rb +0 -45
- data/demo/config.ru +0 -2
- data/demo/index.html.erb +0 -78
- data/demo/new_message.html.erb +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3e948d6b3a8faf888e0f105028bf9b4051b7fa67
|
|
4
|
+
data.tar.gz: 9f62ee471d1d30ecf94e8f23b487059d40ed821f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e1dd49900294cad2345ac17344a715954ad769f0d9fd24a6f60f0b712c55c3b321320d65689eb56c044c91eec1ba3180c17de486fce420d2f8587bd0288d0de
|
|
7
|
+
data.tar.gz: fedad057c7efe7e5f8b1c7679f975cf1ad0494e789cbf072fddead0277112b4145a3e2fdec3c65dc36faedc77efab38d36d4972305d6827de46d06c8d38c3454
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## [1.2.1](https://github.com/fgrehm/letter_opener_web/compare/v1.2.0...v1.2.1) (Apr 07, 2014)
|
|
2
|
+
|
|
3
|
+
- Improve Rails 3 compatibility [#26](https://github.com/fgrehm/letter_opener_web/pull/26) / [#27](https://github.com/fgrehm/letter_opener_web/pull/27)
|
|
4
|
+
|
|
1
5
|
## [1.2.0](https://github.com/fgrehm/letter_opener_web/compare/v1.1.3...v1.2.0) (Apr 07, 2014)
|
|
2
6
|
|
|
3
7
|
- Add support for removing a single email [#23](https://github.com/fgrehm/letter_opener_web/pull/23)
|
data/Gemfile.lock
CHANGED
|
@@ -1,45 +1,44 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
letter_opener_web (1.2.
|
|
4
|
+
letter_opener_web (1.2.1)
|
|
5
5
|
letter_opener (~> 1.0)
|
|
6
6
|
rails (>= 3.2)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: http://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
actionmailer (4.
|
|
12
|
-
actionpack (= 4.
|
|
11
|
+
actionmailer (4.1.1)
|
|
12
|
+
actionpack (= 4.1.1)
|
|
13
|
+
actionview (= 4.1.1)
|
|
13
14
|
mail (~> 2.5.4)
|
|
14
|
-
actionpack (4.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
erubis (~> 2.7.0)
|
|
15
|
+
actionpack (4.1.1)
|
|
16
|
+
actionview (= 4.1.1)
|
|
17
|
+
activesupport (= 4.1.1)
|
|
18
18
|
rack (~> 1.5.2)
|
|
19
19
|
rack-test (~> 0.6.2)
|
|
20
|
-
|
|
21
|
-
activesupport (= 4.
|
|
22
|
-
builder (~> 3.1
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
actionview (4.1.1)
|
|
21
|
+
activesupport (= 4.1.1)
|
|
22
|
+
builder (~> 3.1)
|
|
23
|
+
erubis (~> 2.7.0)
|
|
24
|
+
activemodel (4.1.1)
|
|
25
|
+
activesupport (= 4.1.1)
|
|
26
|
+
builder (~> 3.1)
|
|
27
|
+
activerecord (4.1.1)
|
|
28
|
+
activemodel (= 4.1.1)
|
|
29
|
+
activesupport (= 4.1.1)
|
|
30
|
+
arel (~> 5.0.0)
|
|
31
|
+
activesupport (4.1.1)
|
|
30
32
|
i18n (~> 0.6, >= 0.6.9)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
json (~> 1.7, >= 1.7.7)
|
|
34
|
+
minitest (~> 5.1)
|
|
33
35
|
thread_safe (~> 0.1)
|
|
34
|
-
tzinfo (~>
|
|
36
|
+
tzinfo (~> 1.1)
|
|
35
37
|
addressable (2.3.6)
|
|
36
|
-
arel (
|
|
37
|
-
builder (3.
|
|
38
|
+
arel (5.0.1.20140414130214)
|
|
39
|
+
builder (3.2.2)
|
|
38
40
|
celluloid (0.15.2)
|
|
39
41
|
timers (~> 1.1.0)
|
|
40
|
-
celluloid-io (0.15.0)
|
|
41
|
-
celluloid (>= 0.15.0)
|
|
42
|
-
nio4r (>= 0.5.0)
|
|
43
42
|
coderay (1.1.0)
|
|
44
43
|
combustion (0.5.1)
|
|
45
44
|
activesupport (>= 3.0.0)
|
|
@@ -48,97 +47,103 @@ GEM
|
|
|
48
47
|
diff-lcs (1.2.5)
|
|
49
48
|
erubis (2.7.0)
|
|
50
49
|
ffi (1.9.3)
|
|
51
|
-
formatador (0.2.
|
|
52
|
-
guard (2.6.
|
|
50
|
+
formatador (0.2.5)
|
|
51
|
+
guard (2.6.1)
|
|
53
52
|
formatador (>= 0.2.4)
|
|
54
53
|
listen (~> 2.7)
|
|
55
54
|
lumberjack (~> 1.0)
|
|
56
55
|
pry (>= 0.9.12)
|
|
57
56
|
thor (>= 0.18.1)
|
|
58
|
-
guard-rspec (4.2.
|
|
57
|
+
guard-rspec (4.2.10)
|
|
59
58
|
guard (~> 2.1)
|
|
60
59
|
rspec (>= 2.14, < 4.0)
|
|
61
60
|
hike (1.2.3)
|
|
62
61
|
i18n (0.6.9)
|
|
62
|
+
json (1.8.1)
|
|
63
63
|
launchy (2.4.2)
|
|
64
64
|
addressable (~> 2.3)
|
|
65
65
|
letter_opener (1.2.0)
|
|
66
66
|
launchy (~> 2.2)
|
|
67
|
-
listen (2.7.
|
|
67
|
+
listen (2.7.8)
|
|
68
68
|
celluloid (>= 0.15.2)
|
|
69
|
-
celluloid-io (>= 0.15.0)
|
|
70
69
|
rb-fsevent (>= 0.9.3)
|
|
71
70
|
rb-inotify (>= 0.9)
|
|
72
|
-
lumberjack (1.0.
|
|
71
|
+
lumberjack (1.0.6)
|
|
73
72
|
mail (2.5.4)
|
|
74
73
|
mime-types (~> 1.16)
|
|
75
74
|
treetop (~> 1.4.8)
|
|
76
75
|
method_source (0.8.2)
|
|
77
76
|
mime-types (1.25.1)
|
|
78
|
-
minitest (
|
|
79
|
-
multi_json (1.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
method_source (~> 0.8)
|
|
77
|
+
minitest (5.3.4)
|
|
78
|
+
multi_json (1.10.1)
|
|
79
|
+
polyglot (0.3.5)
|
|
80
|
+
pry (0.10.0)
|
|
81
|
+
coderay (~> 1.1.0)
|
|
82
|
+
method_source (~> 0.8.1)
|
|
85
83
|
slop (~> 3.4)
|
|
86
84
|
rack (1.5.2)
|
|
87
85
|
rack-test (0.6.2)
|
|
88
86
|
rack (>= 1.0)
|
|
89
|
-
rails (4.
|
|
90
|
-
actionmailer (= 4.
|
|
91
|
-
actionpack (= 4.
|
|
92
|
-
|
|
93
|
-
|
|
87
|
+
rails (4.1.1)
|
|
88
|
+
actionmailer (= 4.1.1)
|
|
89
|
+
actionpack (= 4.1.1)
|
|
90
|
+
actionview (= 4.1.1)
|
|
91
|
+
activemodel (= 4.1.1)
|
|
92
|
+
activerecord (= 4.1.1)
|
|
93
|
+
activesupport (= 4.1.1)
|
|
94
94
|
bundler (>= 1.3.0, < 2.0)
|
|
95
|
-
railties (= 4.
|
|
96
|
-
sprockets-rails (~> 2.0
|
|
97
|
-
railties (4.
|
|
98
|
-
actionpack (= 4.
|
|
99
|
-
activesupport (= 4.
|
|
95
|
+
railties (= 4.1.1)
|
|
96
|
+
sprockets-rails (~> 2.0)
|
|
97
|
+
railties (4.1.1)
|
|
98
|
+
actionpack (= 4.1.1)
|
|
99
|
+
activesupport (= 4.1.1)
|
|
100
100
|
rake (>= 0.8.7)
|
|
101
101
|
thor (>= 0.18.1, < 2.0)
|
|
102
|
-
rake (10.
|
|
102
|
+
rake (10.3.2)
|
|
103
103
|
rb-fsevent (0.9.4)
|
|
104
|
-
rb-inotify (0.9.
|
|
104
|
+
rb-inotify (0.9.5)
|
|
105
105
|
ffi (>= 0.5.0)
|
|
106
|
-
rspec (
|
|
107
|
-
rspec-core (~>
|
|
108
|
-
rspec-expectations (~>
|
|
109
|
-
rspec-mocks (~>
|
|
110
|
-
rspec-core (
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
106
|
+
rspec (3.0.0)
|
|
107
|
+
rspec-core (~> 3.0.0)
|
|
108
|
+
rspec-expectations (~> 3.0.0)
|
|
109
|
+
rspec-mocks (~> 3.0.0)
|
|
110
|
+
rspec-core (3.0.1)
|
|
111
|
+
rspec-support (~> 3.0.0)
|
|
112
|
+
rspec-expectations (3.0.1)
|
|
113
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
114
|
+
rspec-support (~> 3.0.0)
|
|
115
|
+
rspec-mocks (3.0.1)
|
|
116
|
+
rspec-support (~> 3.0.0)
|
|
117
|
+
rspec-rails (3.0.1)
|
|
115
118
|
actionpack (>= 3.0)
|
|
116
|
-
activemodel (>= 3.0)
|
|
117
119
|
activesupport (>= 3.0)
|
|
118
120
|
railties (>= 3.0)
|
|
119
|
-
rspec-core (~>
|
|
120
|
-
rspec-expectations (~>
|
|
121
|
-
rspec-mocks (~>
|
|
122
|
-
|
|
121
|
+
rspec-core (~> 3.0.0)
|
|
122
|
+
rspec-expectations (~> 3.0.0)
|
|
123
|
+
rspec-mocks (~> 3.0.0)
|
|
124
|
+
rspec-support (~> 3.0.0)
|
|
125
|
+
rspec-support (3.0.0)
|
|
126
|
+
shoulda-matchers (2.6.1)
|
|
123
127
|
activesupport (>= 3.0.0)
|
|
124
128
|
slop (3.5.0)
|
|
125
|
-
sprockets (2.12.
|
|
129
|
+
sprockets (2.12.1)
|
|
126
130
|
hike (~> 1.2)
|
|
127
131
|
multi_json (~> 1.0)
|
|
128
132
|
rack (~> 1.0)
|
|
129
133
|
tilt (~> 1.1, != 1.3.0)
|
|
130
|
-
sprockets-rails (2.
|
|
134
|
+
sprockets-rails (2.1.3)
|
|
131
135
|
actionpack (>= 3.0)
|
|
132
136
|
activesupport (>= 3.0)
|
|
133
137
|
sprockets (~> 2.8)
|
|
134
138
|
thor (0.19.1)
|
|
135
|
-
thread_safe (0.3.
|
|
139
|
+
thread_safe (0.3.4)
|
|
136
140
|
tilt (1.4.1)
|
|
137
141
|
timers (1.1.0)
|
|
138
142
|
treetop (1.4.15)
|
|
139
143
|
polyglot
|
|
140
144
|
polyglot (>= 0.3.1)
|
|
141
|
-
tzinfo (
|
|
145
|
+
tzinfo (1.2.1)
|
|
146
|
+
thread_safe (~> 0.1)
|
|
142
147
|
|
|
143
148
|
PLATFORMS
|
|
144
149
|
ruby
|
|
@@ -149,5 +154,5 @@ DEPENDENCIES
|
|
|
149
154
|
guard-rspec
|
|
150
155
|
letter_opener_web!
|
|
151
156
|
rb-inotify
|
|
152
|
-
rspec-rails (~>
|
|
157
|
+
rspec-rails (~> 3.0)
|
|
153
158
|
shoulda-matchers (~> 2.5)
|
data/README.md
CHANGED
|
@@ -5,11 +5,13 @@
|
|
|
5
5
|
Gives [letter_opener](https://github.com/ryanb/letter_opener) an interface for
|
|
6
6
|
browsing sent emails.
|
|
7
7
|
|
|
8
|
+
Check out http://letter-opener-web.herokuapp.com to see it in action.
|
|
9
|
+
|
|
8
10
|
## Installation
|
|
9
11
|
|
|
10
12
|
First add the gem to your development environment and run the `bundle` command to install it.
|
|
11
13
|
|
|
12
|
-
gem 'letter_opener_web', '~> 1.
|
|
14
|
+
gem 'letter_opener_web', '~> 1.2.0', :group => :development
|
|
13
15
|
|
|
14
16
|
## Usage
|
|
15
17
|
|
|
@@ -45,20 +47,6 @@ can set `:letter_opener_web` as your delivery method on your
|
|
|
45
47
|
```
|
|
46
48
|
|
|
47
49
|
|
|
48
|
-
## Try it out
|
|
49
|
-
|
|
50
|
-
There is a demo app built with [tiny-rails](https://github.com/fgrehm/tiny-rails)
|
|
51
|
-
available for you to check out how the interface looks like. If you want to give
|
|
52
|
-
a shot at it:
|
|
53
|
-
|
|
54
|
-
```terminal
|
|
55
|
-
git clone https://github.com/fgrehm/letter_opener_web
|
|
56
|
-
cd letter_opener_web/demo
|
|
57
|
-
bundle
|
|
58
|
-
unicorn
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
|
|
62
50
|
## Acknowledgements
|
|
63
51
|
|
|
64
52
|
Special thanks to [@alexrothenberg](https://github.com/alexrothenberg) for some
|
|
@@ -9,8 +9,8 @@ module LetterOpenerWeb
|
|
|
9
9
|
def show
|
|
10
10
|
letter = Letter.find(params[:id])
|
|
11
11
|
text = letter.send("#{params[:style]}_text").
|
|
12
|
-
gsub(/"plain\.html"/, "\"#{letter_path(:id => letter.id, :style => 'plain')}\"").
|
|
13
|
-
gsub(/"rich\.html"/, "\"#{letter_path(:id => letter.id, :style => 'rich')}\"")
|
|
12
|
+
gsub(/"plain\.html"/, "\"#{LetterOpenerWeb.railtie_routes_url_helpers.letter_path(:id => letter.id, :style => 'plain')}\"").
|
|
13
|
+
gsub(/"rich\.html"/, "\"#{LetterOpenerWeb.railtie_routes_url_helpers.letter_path(:id => letter.id, :style => 'rich')}\"")
|
|
14
14
|
render :text => text
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -27,13 +27,13 @@ module LetterOpenerWeb
|
|
|
27
27
|
|
|
28
28
|
def clear
|
|
29
29
|
Letter.destroy_all
|
|
30
|
-
redirect_to letters_path
|
|
30
|
+
redirect_to LetterOpenerWeb.railtie_routes_url_helpers.letters_path
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
def destroy
|
|
34
34
|
letter = Letter.find(params[:id])
|
|
35
35
|
letter.delete
|
|
36
|
-
redirect_to letters_path
|
|
36
|
+
redirect_to LetterOpenerWeb.railtie_routes_url_helpers.letters_path
|
|
37
37
|
end
|
|
38
38
|
end
|
|
39
39
|
end
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
<h1>
|
|
3
3
|
Letters
|
|
4
4
|
<span class="pull-right">
|
|
5
|
-
<%= link_to letters_path, class: 'btn refresh' do %>
|
|
5
|
+
<%= link_to letter_opener_web.letters_path, class: 'btn refresh' do %>
|
|
6
6
|
<i class="icon-refresh"></i>
|
|
7
7
|
Refresh
|
|
8
8
|
<% end %>
|
|
9
|
-
<%= link_to clear_letters_path, method: 'delete', data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' do %>
|
|
9
|
+
<%= link_to letter_opener_web.clear_letters_path, method: 'delete', data: { confirm: 'Are you sure?' }, class: 'btn btn-danger' do %>
|
|
10
10
|
<i class="icon-trash icon-white"></i>
|
|
11
11
|
Clear
|
|
12
12
|
<% end %>
|
|
13
13
|
</span>
|
|
14
14
|
</h1>
|
|
15
|
-
<table class="table table-hover letter-opener" data-letters-path="<%= letters_path %>">
|
|
15
|
+
<table class="table table-hover letter-opener" data-letters-path="<%= letter_opener_web.letters_path %>">
|
|
16
16
|
<thead>
|
|
17
17
|
<tr>
|
|
18
18
|
<th>ID</th>
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
<% if first_letter = @letters.shift %>
|
|
25
25
|
<tr class="active">
|
|
26
26
|
<td>
|
|
27
|
-
<%= link_to(first_letter.id, letter_path(first_letter, style: first_letter.default_style), target: 'mail') %>
|
|
27
|
+
<%= link_to(first_letter.id, letter_opener_web.letter_path(first_letter, style: first_letter.default_style), target: 'mail') %>
|
|
28
28
|
</td>
|
|
29
29
|
<td><%= first_letter.sent_at %></td>
|
|
30
30
|
<td>
|
|
31
|
-
<%= link_to delete_letter_path(first_letter), method: 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
|
|
31
|
+
<%= link_to letter_opener_web.delete_letter_path(first_letter), method: 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
|
|
32
32
|
<span class="pull-right">
|
|
33
33
|
<i class="icon-remove-circle" title="Delete"></i>
|
|
34
34
|
</span>
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
<% @letters.each do |letter| %>
|
|
40
40
|
<tr>
|
|
41
41
|
<td>
|
|
42
|
-
<%= link_to(letter.id, letter_path(letter, style: letter.default_style), target: 'mail') %>
|
|
42
|
+
<%= link_to(letter.id, letter_opener_web.letter_path(letter, style: letter.default_style), target: 'mail') %>
|
|
43
43
|
</td>
|
|
44
44
|
<td><%= letter.sent_at %></td>
|
|
45
45
|
<td>
|
|
46
|
-
<%= link_to delete_letter_path(letter), :method => 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
|
|
46
|
+
<%= link_to letter_opener_web.delete_letter_path(letter), :method => 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
|
|
47
47
|
<span class="pull-right">
|
|
48
48
|
<i class="icon-remove-circle"></i>
|
|
49
49
|
</span>
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
</table>
|
|
56
56
|
</div>
|
|
57
57
|
<div class="col right">
|
|
58
|
-
<iframe name="mail" id="mail" src="<%= first_letter.present? ? letter_path(first_letter, style: first_letter.default_style) : 'about:blank' %>"></iframe>
|
|
58
|
+
<iframe name="mail" id="mail" src="<%= first_letter.present? ? letter_opener_web.letter_path(first_letter, style: first_letter.default_style) : 'about:blank' %>"></iframe>
|
|
59
59
|
</div>
|
data/letter_opener_web.gemspec
CHANGED
|
@@ -21,7 +21,7 @@ Gem::Specification.new do |gem|
|
|
|
21
21
|
gem.add_dependency 'rails', '>= 3.2'
|
|
22
22
|
gem.add_dependency 'letter_opener', '~> 1.0'
|
|
23
23
|
|
|
24
|
-
gem.add_development_dependency 'rspec-rails', '~>
|
|
24
|
+
gem.add_development_dependency 'rspec-rails', '~> 3.0'
|
|
25
25
|
gem.add_development_dependency 'shoulda-matchers', '~> 2.5'
|
|
26
26
|
gem.add_development_dependency 'combustion', '~> 0.5'
|
|
27
27
|
end
|
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
|
3
3
|
describe LetterOpenerWeb::LettersController do
|
|
4
4
|
describe 'GET index' do
|
|
5
5
|
before do
|
|
6
|
-
LetterOpenerWeb::Letter.
|
|
6
|
+
allow(LetterOpenerWeb::Letter).to receive_messages(:search => :all_letters)
|
|
7
7
|
get :index
|
|
8
8
|
end
|
|
9
9
|
it 'should assign all letters to @letters' do
|
|
@@ -19,7 +19,7 @@ describe LetterOpenerWeb::LettersController do
|
|
|
19
19
|
let(:letter) { double(:letter, :rich_text => rich_text, :plain_text => plain_text, :id => id) }
|
|
20
20
|
|
|
21
21
|
before do
|
|
22
|
-
LetterOpenerWeb::Letter.
|
|
22
|
+
allow(LetterOpenerWeb::Letter).to receive_messages(:find => letter)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
context 'rich text version' do
|
|
@@ -56,7 +56,7 @@ describe LetterOpenerWeb::LettersController do
|
|
|
56
56
|
let(:letter) { double(:letter, :attachments => { file_name => attachment_path}, :id => id) }
|
|
57
57
|
|
|
58
58
|
before do
|
|
59
|
-
LetterOpenerWeb::Letter.
|
|
59
|
+
allow(LetterOpenerWeb::Letter).to receive_messages(:find => letter)
|
|
60
60
|
allow(controller).to receive(:send_file) { controller.render :nothing => true }
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -38,7 +38,7 @@ MAIL
|
|
|
38
38
|
let(:id) { '1111_1111' }
|
|
39
39
|
subject { described_class.new(:id => id).rich_text }
|
|
40
40
|
|
|
41
|
-
it {
|
|
41
|
+
it { is_expected.to match(/Rich text for 1111_1111/) }
|
|
42
42
|
|
|
43
43
|
it 'changes links to show up on a new window' do
|
|
44
44
|
expect(subject).to include("<a href='a-link.html' target='_blank'>\n <img src='an-image.jpg'/>\n Link text\n</a>")
|
|
@@ -53,7 +53,7 @@ MAIL
|
|
|
53
53
|
let(:id) { '2222_2222' }
|
|
54
54
|
subject { described_class.new(:id => id).plain_text }
|
|
55
55
|
|
|
56
|
-
it {
|
|
56
|
+
it { is_expected.to match(/Plain text for 2222_2222/) }
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
describe 'default style' do
|
|
@@ -65,7 +65,7 @@ MAIL
|
|
|
65
65
|
end
|
|
66
66
|
|
|
67
67
|
it 'returns plain if rich text version is not present' do
|
|
68
|
-
File.
|
|
68
|
+
allow(File).to receive_messages(:exists? => false)
|
|
69
69
|
expect(subject.default_style).to eq('plain')
|
|
70
70
|
end
|
|
71
71
|
end
|
data/spec/spec_helper.rb
CHANGED
|
@@ -10,9 +10,9 @@ require 'rspec/rails'
|
|
|
10
10
|
require 'shoulda-matchers'
|
|
11
11
|
|
|
12
12
|
RSpec.configure do |config|
|
|
13
|
-
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
14
13
|
config.filter_run :focus => true
|
|
15
14
|
config.run_all_when_everything_filtered = true
|
|
15
|
+
config.infer_spec_type_from_file_location!
|
|
16
16
|
|
|
17
17
|
# Run specs in random order to surface order dependencies. If you find an
|
|
18
18
|
# order dependency and want to debug it, you can fix the order by providing
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: letter_opener_web
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Fabio Rehm
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-06-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
requirements:
|
|
45
45
|
- - "~>"
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '
|
|
47
|
+
version: '3.0'
|
|
48
48
|
type: :development
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - "~>"
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '
|
|
54
|
+
version: '3.0'
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: shoulda-matchers
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -105,14 +105,6 @@ files:
|
|
|
105
105
|
- app/views/layouts/letter_opener_web/application.html.erb
|
|
106
106
|
- app/views/letter_opener_web/letters/index.html.erb
|
|
107
107
|
- config/routes.rb
|
|
108
|
-
- demo/.gitignore
|
|
109
|
-
- demo/Gemfile
|
|
110
|
-
- demo/Gemfile.lock
|
|
111
|
-
- demo/application_controller.rb
|
|
112
|
-
- demo/boot.rb
|
|
113
|
-
- demo/config.ru
|
|
114
|
-
- demo/index.html.erb
|
|
115
|
-
- demo/new_message.html.erb
|
|
116
108
|
- letter_opener_web.gemspec
|
|
117
109
|
- lib/letter_opener_web.rb
|
|
118
110
|
- lib/letter_opener_web/delivery_method.rb
|
data/demo/.gitignore
DELETED
data/demo/Gemfile
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
source "http://rubygems.org"
|
|
2
|
-
|
|
3
|
-
# Required by active_support
|
|
4
|
-
gem "tzinfo"
|
|
5
|
-
|
|
6
|
-
gem "tiny-rails"
|
|
7
|
-
gem "actionpack", "~> 3.2"
|
|
8
|
-
gem "actionmailer", "~> 3.2"
|
|
9
|
-
gem "railties", "~> 3.2"
|
|
10
|
-
|
|
11
|
-
gem "letter_opener_web", path: '../'
|
|
12
|
-
gem "actionmailer_inline_css"
|
|
13
|
-
|
|
14
|
-
gem "unicorn"
|
data/demo/Gemfile.lock
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: ../
|
|
3
|
-
specs:
|
|
4
|
-
letter_opener_web (1.2.0)
|
|
5
|
-
letter_opener (~> 1.0)
|
|
6
|
-
rails (>= 3.2)
|
|
7
|
-
|
|
8
|
-
GEM
|
|
9
|
-
remote: http://rubygems.org/
|
|
10
|
-
specs:
|
|
11
|
-
actionmailer (3.2.17)
|
|
12
|
-
actionpack (= 3.2.17)
|
|
13
|
-
mail (~> 2.5.4)
|
|
14
|
-
actionmailer_inline_css (1.5.3)
|
|
15
|
-
actionmailer (>= 3.0.0)
|
|
16
|
-
nokogiri (>= 1.4.4)
|
|
17
|
-
premailer (>= 1.7.1)
|
|
18
|
-
actionpack (3.2.17)
|
|
19
|
-
activemodel (= 3.2.17)
|
|
20
|
-
activesupport (= 3.2.17)
|
|
21
|
-
builder (~> 3.0.0)
|
|
22
|
-
erubis (~> 2.7.0)
|
|
23
|
-
journey (~> 1.0.4)
|
|
24
|
-
rack (~> 1.4.5)
|
|
25
|
-
rack-cache (~> 1.2)
|
|
26
|
-
rack-test (~> 0.6.1)
|
|
27
|
-
sprockets (~> 2.2.1)
|
|
28
|
-
activemodel (3.2.17)
|
|
29
|
-
activesupport (= 3.2.17)
|
|
30
|
-
builder (~> 3.0.0)
|
|
31
|
-
activerecord (3.2.17)
|
|
32
|
-
activemodel (= 3.2.17)
|
|
33
|
-
activesupport (= 3.2.17)
|
|
34
|
-
arel (~> 3.0.2)
|
|
35
|
-
tzinfo (~> 0.3.29)
|
|
36
|
-
activeresource (3.2.17)
|
|
37
|
-
activemodel (= 3.2.17)
|
|
38
|
-
activesupport (= 3.2.17)
|
|
39
|
-
activesupport (3.2.17)
|
|
40
|
-
i18n (~> 0.6, >= 0.6.4)
|
|
41
|
-
multi_json (~> 1.0)
|
|
42
|
-
addressable (2.3.6)
|
|
43
|
-
arel (3.0.3)
|
|
44
|
-
builder (3.0.4)
|
|
45
|
-
css_parser (1.3.5)
|
|
46
|
-
addressable
|
|
47
|
-
erubis (2.7.0)
|
|
48
|
-
hike (1.2.3)
|
|
49
|
-
htmlentities (4.3.1)
|
|
50
|
-
i18n (0.6.9)
|
|
51
|
-
journey (1.0.4)
|
|
52
|
-
json (1.8.1)
|
|
53
|
-
kgio (2.9.2)
|
|
54
|
-
launchy (2.4.2)
|
|
55
|
-
addressable (~> 2.3)
|
|
56
|
-
letter_opener (1.2.0)
|
|
57
|
-
launchy (~> 2.2)
|
|
58
|
-
mail (2.5.4)
|
|
59
|
-
mime-types (~> 1.16)
|
|
60
|
-
treetop (~> 1.4.8)
|
|
61
|
-
mime-types (1.25.1)
|
|
62
|
-
mini_portile (0.5.3)
|
|
63
|
-
multi_json (1.9.2)
|
|
64
|
-
nokogiri (1.6.1)
|
|
65
|
-
mini_portile (~> 0.5.0)
|
|
66
|
-
polyglot (0.3.4)
|
|
67
|
-
premailer (1.8.2)
|
|
68
|
-
css_parser (>= 1.3.5)
|
|
69
|
-
htmlentities (>= 4.0.0)
|
|
70
|
-
rack (1.4.5)
|
|
71
|
-
rack-cache (1.2)
|
|
72
|
-
rack (>= 0.4)
|
|
73
|
-
rack-ssl (1.3.4)
|
|
74
|
-
rack
|
|
75
|
-
rack-test (0.6.2)
|
|
76
|
-
rack (>= 1.0)
|
|
77
|
-
rails (3.2.17)
|
|
78
|
-
actionmailer (= 3.2.17)
|
|
79
|
-
actionpack (= 3.2.17)
|
|
80
|
-
activerecord (= 3.2.17)
|
|
81
|
-
activeresource (= 3.2.17)
|
|
82
|
-
activesupport (= 3.2.17)
|
|
83
|
-
bundler (~> 1.0)
|
|
84
|
-
railties (= 3.2.17)
|
|
85
|
-
railties (3.2.17)
|
|
86
|
-
actionpack (= 3.2.17)
|
|
87
|
-
activesupport (= 3.2.17)
|
|
88
|
-
rack-ssl (~> 1.3.2)
|
|
89
|
-
rake (>= 0.8.7)
|
|
90
|
-
rdoc (~> 3.4)
|
|
91
|
-
thor (>= 0.14.6, < 2.0)
|
|
92
|
-
raindrops (0.13.0)
|
|
93
|
-
rake (10.2.2)
|
|
94
|
-
rdoc (3.12.2)
|
|
95
|
-
json (~> 1.4)
|
|
96
|
-
sprockets (2.2.2)
|
|
97
|
-
hike (~> 1.2)
|
|
98
|
-
multi_json (~> 1.0)
|
|
99
|
-
rack (~> 1.0)
|
|
100
|
-
tilt (~> 1.1, != 1.3.0)
|
|
101
|
-
thor (0.19.1)
|
|
102
|
-
tilt (1.4.1)
|
|
103
|
-
tiny-rails (0.1.1)
|
|
104
|
-
thor (>= 0.14.6, < 2.0)
|
|
105
|
-
treetop (1.4.15)
|
|
106
|
-
polyglot
|
|
107
|
-
polyglot (>= 0.3.1)
|
|
108
|
-
tzinfo (0.3.39)
|
|
109
|
-
unicorn (4.8.2)
|
|
110
|
-
kgio (~> 2.6)
|
|
111
|
-
rack
|
|
112
|
-
raindrops (~> 0.7)
|
|
113
|
-
|
|
114
|
-
PLATFORMS
|
|
115
|
-
ruby
|
|
116
|
-
|
|
117
|
-
DEPENDENCIES
|
|
118
|
-
actionmailer (~> 3.2)
|
|
119
|
-
actionmailer_inline_css
|
|
120
|
-
actionpack (~> 3.2)
|
|
121
|
-
letter_opener_web!
|
|
122
|
-
railties (~> 3.2)
|
|
123
|
-
tiny-rails
|
|
124
|
-
tzinfo
|
|
125
|
-
unicorn
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
class ApplicationController < ActionController::Base
|
|
2
|
-
append_view_path '.'
|
|
3
|
-
|
|
4
|
-
def index
|
|
5
|
-
render :template => 'index'
|
|
6
|
-
end
|
|
7
|
-
|
|
8
|
-
def send_mail
|
|
9
|
-
ContactMailer.new_message(params[:email], params[:message], params[:attachment]).deliver
|
|
10
|
-
redirect_to '/', :notice => 'Email sent successfully, please check letter_opener_web inbox.'
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
class ContactMailer < ActionMailer::Base
|
|
15
|
-
append_view_path File.dirname(__FILE__)
|
|
16
|
-
|
|
17
|
-
default :to => 'admin@letter_opener_web.com',
|
|
18
|
-
:from => 'no-reply@letter_opener_web.com',
|
|
19
|
-
:template_path => '.'
|
|
20
|
-
|
|
21
|
-
def new_message(from, message, attachment)
|
|
22
|
-
@from, @message = from, message
|
|
23
|
-
if attachment.present?
|
|
24
|
-
attachments[attachment.original_filename] = attachment.tempfile.read
|
|
25
|
-
end
|
|
26
|
-
mail(:subject => 'Testing letter_opener_web', :template_name => 'new_message')
|
|
27
|
-
end
|
|
28
|
-
end
|
data/demo/boot.rb
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
$:.unshift Dir.pwd
|
|
2
|
-
|
|
3
|
-
require 'bundler'
|
|
4
|
-
Bundler.setup :default
|
|
5
|
-
|
|
6
|
-
require "tiny-rails"
|
|
7
|
-
require "rails"
|
|
8
|
-
|
|
9
|
-
require "action_controller/railtie"
|
|
10
|
-
require "sprockets/railtie"
|
|
11
|
-
require "action_mailer/railtie"
|
|
12
|
-
|
|
13
|
-
Bundler.require :default
|
|
14
|
-
|
|
15
|
-
class TinyRailsApp < Rails::Application
|
|
16
|
-
config.consider_all_requests_local = true
|
|
17
|
-
|
|
18
|
-
config.active_support.deprecation = :log
|
|
19
|
-
|
|
20
|
-
config.autoload_paths << config.root
|
|
21
|
-
|
|
22
|
-
config.middleware.delete "Rack::Lock"
|
|
23
|
-
config.middleware.delete "ActionDispatch::BestStandardsSupport"
|
|
24
|
-
config.middleware.use Rails::Rack::LogTailer, "log/#{Rails.env}.log"
|
|
25
|
-
|
|
26
|
-
# We need a secret token for session, cookies, etc.
|
|
27
|
-
config.secret_token = "49837489qkuweoiuoqwehisuakshdjksadhaisdy78o34y138974xyqp9rmye8yrpiokeuioqwzyoiuxftoyqiuxrhm3iou1hrzmjk"
|
|
28
|
-
|
|
29
|
-
# Enable asset pipeline
|
|
30
|
-
config.assets.enabled = true
|
|
31
|
-
config.assets.debug = true
|
|
32
|
-
|
|
33
|
-
config.action_mailer.delivery_method = :letter_opener_web
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
require 'initializers' if File.exists?('initializers.rb')
|
|
37
|
-
|
|
38
|
-
TinyRailsApp.initialize!
|
|
39
|
-
|
|
40
|
-
TinyRailsApp.routes.draw do
|
|
41
|
-
get "/" => 'application#index'
|
|
42
|
-
post "/" => 'application#send_mail'
|
|
43
|
-
mount LetterOpenerWeb::Engine, at: "/letter_opener"
|
|
44
|
-
match "/favicon.ico", :to => proc {|env| [200, {}, [""]] }
|
|
45
|
-
end
|
data/demo/config.ru
DELETED
data/demo/index.html.erb
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>LetterOpenerWeb Test APP</title>
|
|
5
|
-
<%= stylesheet_link_tag "letter_opener_web/bootstrap.min" %>
|
|
6
|
-
<style>
|
|
7
|
-
body {
|
|
8
|
-
padding-top: 20px;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.alert {
|
|
12
|
-
margin-top: 20px;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
h1, .footer {
|
|
16
|
-
text-align: center;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.icon-white {
|
|
20
|
-
background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings-white.png"%>);
|
|
21
|
-
}
|
|
22
|
-
</style>
|
|
23
|
-
</head>
|
|
24
|
-
<body>
|
|
25
|
-
<div class="container">
|
|
26
|
-
<h1>LetterOpenerWeb Test App</h1>
|
|
27
|
-
|
|
28
|
-
<div class="row">
|
|
29
|
-
<div class="span6 offset3">
|
|
30
|
-
|
|
31
|
-
<div class="well">
|
|
32
|
-
<form method="post" action="/" enctype="multipart/form-data">
|
|
33
|
-
<legend>Contact form</legend>
|
|
34
|
-
<div class="control-group">
|
|
35
|
-
<label class="control-label" for="email">Email</label>
|
|
36
|
-
<div class="controls">
|
|
37
|
-
<input type="text" class="input-block-level" name="email">
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
<div class="control-group">
|
|
41
|
-
<label class="control-label" for="attachment">Attachment <em>(optional)</em></label>
|
|
42
|
-
<div class="controls">
|
|
43
|
-
<input type='file' name='attachment' />
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
<div class="control-group">
|
|
47
|
-
<label class="control-label" for="message">Message</label>
|
|
48
|
-
<div class="controls">
|
|
49
|
-
<textarea class="input-block-level" name="message" rows="6"></textarea>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
<div class="control-group">
|
|
53
|
-
<div class="controls">
|
|
54
|
-
<button type="submit" class="btn btn-primary pull-right">
|
|
55
|
-
<i class="icon-envelope icon-white"></i>
|
|
56
|
-
Send mail
|
|
57
|
-
</button>
|
|
58
|
-
<div class="clearfix"></div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</form>
|
|
62
|
-
|
|
63
|
-
<p class="footer">
|
|
64
|
-
<a href="/letter_opener" target="_blank">Click here</a>
|
|
65
|
-
to see sent mails
|
|
66
|
-
</p>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<% if flash.key?(:notice) %>
|
|
70
|
-
<div class="alert alert-success">
|
|
71
|
-
<%= flash[:notice] %>
|
|
72
|
-
</div>
|
|
73
|
-
<% end %>
|
|
74
|
-
</div>
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</body>
|
|
78
|
-
</html>
|
data/demo/new_message.html.erb
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
<style type="text/css">
|
|
2
|
-
label { font-weight: bold; }
|
|
3
|
-
.from { color: #888; font-style: italic }
|
|
4
|
-
.message { padding-left: 10px; }
|
|
5
|
-
.message p:first-child { margin-top: 0; }
|
|
6
|
-
</style>
|
|
7
|
-
|
|
8
|
-
<h1>New message!</h1>
|
|
9
|
-
|
|
10
|
-
<p>
|
|
11
|
-
<label>From:</label>
|
|
12
|
-
<span class="from"><%= @from %></span>
|
|
13
|
-
</p>
|
|
14
|
-
|
|
15
|
-
<p>
|
|
16
|
-
<label>Message:</label>
|
|
17
|
-
</p>
|
|
18
|
-
|
|
19
|
-
<div class="message">
|
|
20
|
-
<%= simple_format @message %>
|
|
21
|
-
</div>
|