letter_opener-iso-2022-jp 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 1e8c3d9bb75446b0e397d703921c4c6c1362db23
4
- data.tar.gz: 0562da1afc83a54ddab58461b08cfbed2b50cd33
3
+ metadata.gz: b1ed28d350e626d9fcd778ec24ae62547f1c8f30
4
+ data.tar.gz: e31baab7068c793c1078a53c7c02311ed562158c
5
5
  SHA512:
6
- metadata.gz: 54796e81b98f1207261139220d259d71eb262f5933070e26c096303fc273118ec1dff70ae6e24f7549844907474f7961e424635fe686f1885c52257e67938736
7
- data.tar.gz: 206940ca0dc6853fdef7437493c096a2f97834f70b1f9436ebbf799fa1be30d937e343322f38083d4c04e949143e37177fe26b0cf0b2e4595b2d805e5590e8ef
6
+ metadata.gz: cf4254863fca2e528b179d000ea6381e0de14c283f01995f75cb177808c1f6bc50b0b6854f248a19c1c729bed496d2d63ccfead59a01ad8d68d6f15251165675
7
+ data.tar.gz: 13af8b91e4a47350ad71b13a2010fe020aeb5a2d388e9f75d7c8007b5e5fd3f492bdad9782595ab3ddbb8c72f8e60bf955b6971abf0d9ac6a76e9227e2e3d933
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "letter_opener-iso-2022-jp"
7
- spec.version = "0.1.0"
7
+ spec.version = "0.1.1"
8
8
  spec.authors = ["hamajyotan"]
9
9
  spec.email = ["takashi.sakaguchi@ummm.info"]
10
10
  spec.description = "This patch provides 'letter_opener' gem with iso-2022-jp conversion capability."
@@ -19,9 +19,10 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake"
22
- spec.add_development_dependency "rspec"
22
+ spec.add_development_dependency "rspec", "~> 3.0"
23
+ spec.add_development_dependency "rspec-its"
23
24
  spec.add_development_dependency "mail-iso-2022-jp"
24
- spec.add_development_dependency "pry-debugger"
25
+ spec.add_development_dependency "pry-byebug"
25
26
 
26
27
  spec.add_dependency "letter_opener"
27
28
  end
@@ -2,7 +2,7 @@
2
2
  module LetterOpener
3
3
  module Iso2022JpToUtf8
4
4
  def decode value
5
- NKF.nkf("-m -w -J", value)
5
+ [*value].map { |v| NKF.nkf("-m -w -J", v) }.join(', ')
6
6
  end
7
7
  module_function :decode
8
8
  end
@@ -8,50 +8,47 @@ describe LetterOpener, launchy_mock: true do
8
8
  context "given utf-8 encoded mail" do
9
9
  before do
10
10
  Mail.new(charset: "UTF-8") {
11
- from "差出人 <foo@example.com>"
12
- to "宛先 <bar@example.com>"
11
+ from ["差出人1 <foo@example.com>", "差出人2 <hoge@example.com>"]
12
+ to ["宛先1 <bar@example.com>", "宛先2 <fuga@example.com>"]
13
13
  subject "日本語のタイトル"
14
14
  content_type "text/plain; charset=UTF-8"
15
15
  body "日本語の本文 (UTF-8)"
16
16
  }.deliver
17
17
  end
18
18
 
19
- describe "messages" do
20
- subject { messages }
21
- its(:size) { should == 1 }
22
- end
23
- describe "messages[#{0}]" do
24
- subject { messages[0] }
25
- its(:type) { should == :text }
26
- its(:raw) { should match "<dd>&quot;差出人&quot; &lt;foo@example.com&gt;</dd>" }
27
- its(:raw) { should match "<dd>&quot;宛先&quot; &lt;bar@example.com&gt;</dd>" }
28
- its(:raw) { should match "<dd><strong>日本語のタイトル</strong></dd>" }
29
- its(:raw) { should match '<pre id=\"message_body\">日本語の本文 \(UTF-8\)</pre>' }
19
+ it "should UTF8 encoding messages" do
20
+ aggregate_failures do
21
+ expect(messages.size).to eq 1
22
+ expect(messages[0].type).to eq :text
23
+ expect(messages[0].raw).to match "<dd>&quot;差出人1&quot; &lt;foo@example.com&gt;, &quot;差出人2&quot; &lt;hoge@example.com&gt;</dd>"
24
+ expect(messages[0].raw).to match "<dd>&quot;宛先1&quot; &lt;bar@example.com&gt;, &quot;宛先2&quot; &lt;fuga@example.com&gt;</dd>"
25
+ expect(messages[0].raw).to match "<dd><strong>日本語のタイトル</strong></dd>"
26
+ expect(messages[0].raw).to match '<pre id=\"message_body\">日本語の本文 \(UTF-8\)</pre>'
27
+ end
30
28
  end
31
29
  end
32
30
 
33
31
  context "given iso-2022-jp encoded mail" do
34
32
  before do
35
33
  Mail.new(charset: "ISO-2022-JP") {
36
- from "差出人 <foo@example.com>"
37
- to "宛先 <bar@example.com>"
34
+ from ["差出人1 <foo@example.com>", "差出人2 <hoge@example.com>"]
35
+ to ["宛先1 <bar@example.com>", "宛先2 <fuga@example.com>"]
38
36
  subject "とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル"
39
37
  content_type "text/plain; charset=ISO-2022-JP"
40
38
  body "日本語の本文 ISO-2022-JP バージョン"
41
39
  }.deliver
42
40
  end
43
41
 
44
- describe "messages" do
45
- subject { messages }
46
- its(:size) { should == 1 }
47
- end
48
- describe "messages[#{0}]" do
49
- subject { messages[0] }
50
- its(:type) { should == :text }
51
- its(:raw) { should match "<dd>差出人 &lt;foo@example.com&gt;</dd>" }
52
- its(:raw) { should match "<dd>宛先 &lt;bar@example.com&gt;</dd>" }
53
- its(:raw) { should match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>" }
54
- its(:raw) { should match '<pre id=\"message_body\">日本語の本文 ISO-2022-JP バージョン</pre>' }
42
+ it "should UTF8 encoding messages" do
43
+ aggregate_failures do
44
+ expect(messages.size).to eq 1
45
+ expect(messages[0].type).to eq :text
46
+ # TODO: originally should be "<dd>&quot;差出人1&quot; &lt;foo@example.com&gt;, &quot;差出人2&quot; &lt;hoge@example.com&gt;</dd>"
47
+ expect(messages[0].raw).to match "<dd>差出人1 &lt;foo@example.com&gt;, 差出人2 &lt;hoge@example.com&gt;</dd>"
48
+ expect(messages[0].raw).to match "<dd>宛先1 &lt;bar@example.com&gt;, 宛先2 &lt;fuga@example.com&gt;</dd>"
49
+ expect(messages[0].raw).to match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>"
50
+ expect(messages[0].raw).to match '<pre id=\"message_body\">日本語の本文 ISO-2022-JP バージョン</pre>'
51
+ end
55
52
  end
56
53
  end
57
54
  end
@@ -76,25 +73,20 @@ describe LetterOpener, launchy_mock: true do
76
73
  }.deliver
77
74
  end
78
75
 
79
- describe "messages" do
80
- subject { messages }
81
- its(:size) { should == 2 }
82
- end
83
- describe "messages[#{0}]" do
84
- subject { messages[0] }
85
- its(:type) { should == :text }
86
- its(:raw) { should match "<dd>&quot;差出人&quot; &lt;foo@example.com&gt;</dd>" }
87
- its(:raw) { should match "<dd>&quot;宛先&quot; &lt;bar@example.com&gt;</dd>" }
88
- its(:raw) { should match "<dd><strong>日本語のタイトル</strong></dd>" }
89
- its(:raw) { should match '<pre id=\"message_body\">日本語の本文 \(UTF-8\)</pre>' }
90
- end
91
- describe "messages[#{1}]" do
92
- subject { messages[1] }
93
- its(:type) { should == :html }
94
- its(:raw) { should match "<dd>&quot;差出人&quot; &lt;foo@example.com&gt;</dd>" }
95
- its(:raw) { should match "<dd>&quot;宛先&quot; &lt;bar@example.com&gt;</dd>" }
96
- its(:raw) { should match "<dd><strong>日本語のタイトル</strong></dd>" }
97
- its(:raw) { should match "<h1>日本語の本文 \\(UTF-8\\)</h1>" }
76
+ it "should UTF8 encoding messages" do
77
+ aggregate_failures do
78
+ expect(messages.size).to eq 2
79
+ expect(messages[0].type).to eq :text
80
+ expect(messages[0].raw).to match "<dd>&quot;差出人&quot; &lt;foo@example.com&gt;</dd>"
81
+ expect(messages[0].raw).to match "<dd>&quot;宛先&quot; &lt;bar@example.com&gt;</dd>"
82
+ expect(messages[0].raw).to match "<dd><strong>日本語のタイトル</strong></dd>"
83
+ expect(messages[0].raw).to match '<pre id=\"message_body\">日本語の本文 \(UTF-8\)</pre>'
84
+ expect(messages[1].type).to eq :html
85
+ expect(messages[1].raw).to match "<dd>&quot;差出人&quot; &lt;foo@example.com&gt;</dd>"
86
+ expect(messages[1].raw).to match "<dd>&quot;宛先&quot; &lt;bar@example.com&gt;</dd>"
87
+ expect(messages[1].raw).to match "<dd><strong>日本語のタイトル</strong></dd>"
88
+ expect(messages[1].raw).to match "&lt;h1&gt;日本語の本文 \\(UTF-8\\)&lt;/h1&gt;"
89
+ end
98
90
  end
99
91
  end
100
92
 
@@ -116,25 +108,20 @@ describe LetterOpener, launchy_mock: true do
116
108
  }.deliver
117
109
  end
118
110
 
119
- describe "messages" do
120
- subject { messages }
121
- its(:size) { should == 2 }
122
- end
123
- describe "messages[#{0}]" do
124
- subject { messages[0] }
125
- its(:type) { should == :text }
126
- its(:raw) { should match "<dd>差出人 &lt;foo@example.com&gt;</dd>" }
127
- its(:raw) { should match "<dd>宛先 &lt;bar@example.com&gt;</dd>" }
128
- its(:raw) { should match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>" }
129
- its(:raw) { should match '<pre id=\"message_body\">日本語の本文 ISO-2022-JP バージョン</pre>' }
130
- end
131
- describe "messages[#{1}]" do
132
- subject { messages[1] }
133
- its(:type) { should == :html }
134
- its(:raw) { should match "<dd>差出人 &lt;foo@example.com&gt;</dd>" }
135
- its(:raw) { should match "<dd>宛先 &lt;bar@example.com&gt;</dd>" }
136
- its(:raw) { should match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>" }
137
- its(:raw) { should match "<h1>日本語の本文 ISO-2022-JP バージョン</h1>" }
111
+ it "should UTF8 encoding messages" do
112
+ aggregate_failures do
113
+ expect(messages.size).to eq 2
114
+ expect(messages[0].type).to eq :text
115
+ expect(messages[0].raw).to match "<dd>差出人 &lt;foo@example.com&gt;</dd>"
116
+ expect(messages[0].raw).to match "<dd>宛先 &lt;bar@example.com&gt;</dd>"
117
+ expect(messages[0].raw).to match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>"
118
+ expect(messages[0].raw).to match '<pre id=\"message_body\">日本語の本文 ISO-2022-JP バージョン</pre>'
119
+ expect(messages[1].type).to eq :html
120
+ expect(messages[1].raw).to match "<dd>差出人 &lt;foo@example.com&gt;</dd>"
121
+ expect(messages[1].raw).to match "<dd>宛先 &lt;bar@example.com&gt;</dd>"
122
+ expect(messages[1].raw).to match "<dd><strong>とてもとてもとてもとてもとてもとても very とてもとてもとてもとてもとてもとても長い日本語のタイトル</strong></dd>"
123
+ expect(messages[1].raw).to match "&lt;h1&gt;日本語の本文 ISO-2022-JP バージョン&lt;/h1&gt;"
124
+ end
138
125
  end
139
126
  end
140
127
  end
@@ -1,7 +1,8 @@
1
1
 
2
2
  require "letter_opener"
3
3
  require "mail-iso-2022-jp"
4
- require "pry-debugger"
4
+ require "pry-byebug"
5
+ require "rspec/its"
5
6
 
6
7
  require "letter_opener-iso-2022-jp"
7
8
 
@@ -16,7 +16,7 @@ end
16
16
 
17
17
  shared_context 'mimiced to receive mail', launchy_mock: true do
18
18
  before do
19
- Launchy.stub!(:open).and_return do |uri|
19
+ allow(Launchy).to receive(:open) do |uri|
20
20
  path = URI.parse(uri).path
21
21
  dir = File.dirname(path)
22
22
 
metadata CHANGED
@@ -1,97 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_opener-iso-2022-jp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - hamajyotan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-05 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec-its
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
46
60
  - !ruby/object:Gem::Version
47
61
  version: '0'
48
62
  type: :development
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
- - - '>='
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: mail-iso-2022-jp
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - '>='
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
75
  version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - '>='
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
82
  version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
- name: pry-debugger
84
+ name: pry-byebug
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - '>='
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
89
  version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - '>='
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: letter_opener
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - '>='
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '0'
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - '>='
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
110
  version: '0'
97
111
  description: This patch provides 'letter_opener' gem with iso-2022-jp conversion capability.
@@ -101,7 +115,7 @@ executables: []
101
115
  extensions: []
102
116
  extra_rdoc_files: []
103
117
  files:
104
- - .gitignore
118
+ - ".gitignore"
105
119
  - Gemfile
106
120
  - LICENSE.txt
107
121
  - README.md
@@ -124,17 +138,17 @@ require_paths:
124
138
  - lib
125
139
  required_ruby_version: !ruby/object:Gem::Requirement
126
140
  requirements:
127
- - - '>='
141
+ - - ">="
128
142
  - !ruby/object:Gem::Version
129
143
  version: '0'
130
144
  required_rubygems_version: !ruby/object:Gem::Requirement
131
145
  requirements:
132
- - - '>='
146
+ - - ">="
133
147
  - !ruby/object:Gem::Version
134
148
  version: '0'
135
149
  requirements: []
136
150
  rubyforge_project:
137
- rubygems_version: 2.0.0
151
+ rubygems_version: 2.6.8
138
152
  signing_key:
139
153
  specification_version: 4
140
154
  summary: letter_opener with iso-2022-jp encoding.