letter_opener 1.8.1 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24fd95e9b83775041fa1087e3f588a311c12bc88170cbb51ddcd7c6ea59b0fce
4
- data.tar.gz: f1676e6558e372755fccad3e38bf4d4fe2c7f0cbe2b33244549aa45d66a78057
3
+ metadata.gz: c06d502d3736f95a1635442dacb3b95c220817e858a7fd0ffe5ef4a0c6c9867e
4
+ data.tar.gz: 77db833cf96f1bc510d138ce97f517f95c7017ede20e981c87fdf09b4dc6cd26
5
5
  SHA512:
6
- metadata.gz: af3804dc8474cbfcf68cfe797b248f318387ab3973c1bf55e12585c457afd989e8ae14ede4a9f1e6381faed14d2ef55630ffecd877cf48bb496796cae593df5e
7
- data.tar.gz: 57d8e9f5c4eaa0303465f7766eaf5a8e94a9b6a734d4c3965b767db3110539800987151f8e2cdf5d3b3286519f25fb7f0fe1c95689b94e00812c77a564dc4622
6
+ metadata.gz: ccadf9e721f76cf3d5fcee6f1af12e72f466363f9a8f6b5098794845de0019327a58c26ddce992f204fc33098115ca6cf7c8cb227671691d1dc8bee7de992561
7
+ data.tar.gz: 4b73d444fcb8342b74ec301fa4da651737b300944817eaf6acb5a2039124f6bb23844130dd1b90a7fec740a8901d733ba99df77a520fcb71b62af6b01b897e85
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.9.0 ##
2
+ * Store mail location in `Mail::Message` object (thanks [Jonathan Chan](https://github.com/jonmchan))
3
+ * Drop Ruby 2 support. Support only Ruby 3.0+
4
+ * Remove `nkf` gem dependency.
5
+
1
6
  ## 1.8.1 ##
2
7
  * Fix duplication of Rails tasks caused by LetterOpener's rake task file. (thanks [zarqman](https://github.com/zarqman))
3
8
 
data/README.md CHANGED
@@ -40,10 +40,6 @@ LetterOpener.configure do |config|
40
40
  end
41
41
  ```
42
42
 
43
- ### For Rails 2.3.x support
44
-
45
- There is a fork that add support for Rails 2.3.x, in order to use that or just check it out you should go to https://github.com/cavi21/letter_opener
46
-
47
43
  ## Non Rails Setup
48
44
 
49
45
  If you aren't using Rails, this can be easily set up with the Mail gem. Just set the delivery method when configuring Mail and specify a location.
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = "letter_opener"
3
+ s.version = "1.9.0"
4
+ s.author = "Ryan Bates"
5
+ s.email = "ryan@railscasts.com"
6
+ s.homepage = "https://github.com/ryanb/letter_opener"
7
+ s.summary = "Preview mail in browser instead of sending."
8
+ s.description = "When mail is sent from your application, Letter Opener will open a preview in the browser instead of sending."
9
+ s.license = "MIT"
10
+
11
+ s.files = Dir["{lib,spec}/**/*", "[A-Z]*"] - ["Gemfile.lock"]
12
+ s.require_path = "lib"
13
+
14
+ s.add_dependency 'launchy', '>= 2.2', '< 3'
15
+
16
+ s.add_development_dependency 'rspec', '~> 3.10.0'
17
+ s.add_development_dependency 'mail', '~> 2.6.0'
18
+
19
+ s.required_rubygems_version = ">= 1.3.4"
20
+
21
+ if s.respond_to?(:metadata)
22
+ s.metadata = {
23
+ 'bug_tracker_uri' => 'https://github.com/ryanb/letter_opener/issues',
24
+ 'changelog_uri' => 'https://github.com/ryanb/letter_opener/blob/master/CHANGELOG.md',
25
+ 'documentation_uri' => 'http://www.rubydoc.info/gems/letter_opener/',
26
+ 'homepage_uri' => 'https://github.com/ryanb/letter_opener',
27
+ 'source_code_uri' => 'https://github.com/ryanb/letter_opener/',
28
+ }
29
+ end
30
+ end
@@ -2,7 +2,6 @@ require "cgi"
2
2
  require "erb"
3
3
  require "fileutils"
4
4
  require "uri"
5
- require "kconv"
6
5
 
7
6
  module LetterOpener
8
7
  class Message
@@ -51,6 +50,8 @@ module LetterOpener
51
50
  File.open(filepath, 'w') do |f|
52
51
  f.write ERB.new(template).result(binding)
53
52
  end
53
+
54
+ mail["location_#{type}"] = filepath
54
55
  end
55
56
 
56
57
  def template
@@ -86,7 +87,7 @@ module LetterOpener
86
87
  end
87
88
 
88
89
  def subject
89
- @subject ||= @mail.subject.toutf8
90
+ @subject ||= @mail.subject
90
91
  end
91
92
 
92
93
  def to
@@ -216,6 +216,23 @@ describe LetterOpener::Message do
216
216
  end
217
217
  end
218
218
 
219
+ describe '#render' do
220
+ it 'records the saved email path for plain content type' do
221
+ mail = mail(:subject => 'test_mail')
222
+ message = described_class.new(mail, location: location)
223
+ message.render
224
+ expect(mail['location_plain'].value).to end_with('tmp/letter_opener/plain.html')
225
+ end
226
+
227
+
228
+ it 'records the saved email path for rich content type' do
229
+ mail = mail(:content_type => 'text/html', :subject => 'test_mail')
230
+ message = described_class.new(mail, location: location)
231
+ message.render
232
+ expect(mail['location_rich'].value).to end_with('tmp/letter_opener/rich.html')
233
+ end
234
+ end
235
+
219
236
  describe '.rendered_messages' do
220
237
  it 'uses configured default template if options not given' do
221
238
  allow(LetterOpener.configuration).to receive(:location) { location }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_opener
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Bates
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-19 00:00:00.000000000 Z
11
+ date: 2024-02-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: launchy
@@ -70,6 +70,7 @@ files:
70
70
  - LICENSE
71
71
  - README.md
72
72
  - Rakefile
73
+ - letter_opener.gemspec
73
74
  - lib/letter_opener.rb
74
75
  - lib/letter_opener/configuration.rb
75
76
  - lib/letter_opener/delivery_method.rb
@@ -90,7 +91,7 @@ metadata:
90
91
  documentation_uri: http://www.rubydoc.info/gems/letter_opener/
91
92
  homepage_uri: https://github.com/ryanb/letter_opener
92
93
  source_code_uri: https://github.com/ryanb/letter_opener/
93
- post_install_message:
94
+ post_install_message:
94
95
  rdoc_options: []
95
96
  require_paths:
96
97
  - lib
@@ -105,8 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  - !ruby/object:Gem::Version
106
107
  version: 1.3.4
107
108
  requirements: []
108
- rubygems_version: 3.0.9
109
- signing_key:
109
+ rubygems_version: 3.4.7
110
+ signing_key:
110
111
  specification_version: 4
111
112
  summary: Preview mail in browser instead of sending.
112
113
  test_files: []