entp-astrotrain 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/astrotrain.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{astrotrain}
5
- s.version = "0.4.0"
5
+ s.version = "0.4.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["technoweenie"]
@@ -173,7 +173,7 @@ module Astrotrain
173
173
  end
174
174
 
175
175
  def message_id
176
- @message_id ||= mail.header('message-id').to_s.gsub(/^<|>$/, '')
176
+ @message_id ||= header('message-id').to_s.gsub(/^<|>$/, '')
177
177
  end
178
178
 
179
179
  def body
data/test/message_test.rb CHANGED
@@ -145,6 +145,10 @@ class Astrotrain::MessageTest < Astrotrain::TestCase
145
145
  @message = Astrotrain::Message.parse(@raw)
146
146
  end
147
147
 
148
+ it "parses message-id" do
149
+ assert_equal 'a16be7390810161014n52b603e9k1aa6bb803c6735aa@mail.gmail.com', @message.message_id
150
+ end
151
+
148
152
  it "parses TMail::Mail headers" do
149
153
  expected = {'mime-version' => '1.0', 'content-type' => 'text/plain; charset=ISO-8859-1', 'to' => 'Processor <processor@astrotrain.com>',
150
154
  'x-custom' => 'reply', 'content-transfer-encoding' => '7bit', 'content-disposition' => 'inline', 'message-id' => '<a16be7390810161014n52b603e9k1aa6bb803c6735aa@mail.gmail.com>'}
@@ -58,53 +58,55 @@ class Astrotrain::TransportTest < Astrotrain::TestCase
58
58
  end
59
59
  end
60
60
 
61
- describe "jabber" do
62
- before :all do
63
- @dest = 'foo@bar.com'
64
- @message = Astrotrain::Message.parse(mail(:custom))
65
- @mapping = Astrotrain::Mapping.new(:destination => @dest, :transport => 'jabber')
66
- end
67
-
68
- before do
69
- @trans = Astrotrain::Mapping::Jabber.new(@message, @mapping, @message.recipients(%w(delivered_to)).first)
70
- end
71
-
72
- it "sets #content" do
73
- expected = "From: %s\nTo: %s\nSubject: %s\nEmails: %s\n%s" % [@message.sender, @message.recipients(%w(delivered_to)).first, @message.subject, @message.recipients(%w(original_to to)) * ", ", @message.body]
74
- assert_equal expected, @trans.content
75
- end
76
-
77
- it "sets content with mapping separator set" do
78
- @message = Astrotrain::Message.parse(mail(:reply))
79
- @mapping.separator = "=" * 5
80
- @trans = Astrotrain::Mapping::Jabber.new(@message, @mapping, @message.recipients(%w(delivered_to)).first)
81
- expected = "From: %s\nTo: %s\nSubject: %s\nEmails: %s\n%s" % [@message.sender, @message.recipients(%w(delivered_to)).first, @message.subject, '', "blah blah"]
82
- assert_equal expected, @trans.content
83
- end
84
-
85
- describe "when processing" do
86
- before do
87
- @conn = Object.new
88
- stub(@trans).connection { @conn }
89
- stub(Astrotrain::Mapping::Jabber).new { @trans }
61
+ if Astrotrain::Mapping.const_defined?(:Jabber)
62
+ describe "jabber" do
63
+ before :all do
64
+ @dest = 'foo@bar.com'
65
+ @message = Astrotrain::Message.parse(mail(:custom))
66
+ @mapping = Astrotrain::Mapping.new(:destination => @dest, :transport => 'jabber')
90
67
  end
91
68
 
92
- it "makes jabber delivery" do
93
- mock(@conn).deliver(@mapping.destination, @trans.content)
94
- @trans.process
69
+ before do
70
+ @trans = Astrotrain::Mapping::Jabber.new(@message, @mapping, @message.recipients(%w(delivered_to)).first)
95
71
  end
96
72
 
97
- it "makes jabber delivery from Transport" do
98
- mock(@conn).deliver(@mapping.destination, @trans.content)
99
- Astrotrain::Mapping::Transport.process(@message, @mapping, @message.recipients(%w(delivered_to)).first)
73
+ it "sets #content" do
74
+ expected = "From: %s\nTo: %s\nSubject: %s\nEmails: %s\n%s" % [@message.sender, @message.recipients(%w(delivered_to)).first, @message.subject, @message.recipients(%w(original_to to)) * ", ", @message.body]
75
+ assert_equal expected, @trans.content
100
76
  end
101
77
 
102
- before :all do
103
- Astrotrain::Mapping::Transport.processing = true
78
+ it "sets content with mapping separator set" do
79
+ @message = Astrotrain::Message.parse(mail(:reply))
80
+ @mapping.separator = "=" * 5
81
+ @trans = Astrotrain::Mapping::Jabber.new(@message, @mapping, @message.recipients(%w(delivered_to)).first)
82
+ expected = "From: %s\nTo: %s\nSubject: %s\nEmails: %s\n%s" % [@message.sender, @message.recipients(%w(delivered_to)).first, @message.subject, '', "blah blah"]
83
+ assert_equal expected, @trans.content
104
84
  end
105
85
 
106
- after :all do
107
- Astrotrain::Mapping::Transport.processing = false
86
+ describe "when processing" do
87
+ before do
88
+ @conn = Object.new
89
+ stub(@trans).connection { @conn }
90
+ stub(Astrotrain::Mapping::Jabber).new { @trans }
91
+ end
92
+
93
+ it "makes jabber delivery" do
94
+ mock(@conn).deliver(@mapping.destination, @trans.content)
95
+ @trans.process
96
+ end
97
+
98
+ it "makes jabber delivery from Transport" do
99
+ mock(@conn).deliver(@mapping.destination, @trans.content)
100
+ Astrotrain::Mapping::Transport.process(@message, @mapping, @message.recipients(%w(delivered_to)).first)
101
+ end
102
+
103
+ before :all do
104
+ Astrotrain::Mapping::Transport.processing = true
105
+ end
106
+
107
+ after :all do
108
+ Astrotrain::Mapping::Transport.processing = false
109
+ end
108
110
  end
109
111
  end
110
112
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: entp-astrotrain
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - technoweenie