luggage 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -57,9 +57,9 @@ module Luggage
57
57
  Message.new_local(connection, mailbox, args, &block)
58
58
  end
59
59
 
60
- def mailboxes(*args)
60
+ def mailboxes(*args, &block)
61
61
  array = MailboxArray.new(connection)
62
- args.empty? ? array : array[*args]
62
+ args.empty? ? array : array[*args, &block]
63
63
  end
64
64
 
65
65
  def inspect
@@ -42,7 +42,7 @@ module Luggage
42
42
  def initialize(connection, mailbox, args = {}, &block)
43
43
  @connection = connection
44
44
  @mailbox = mailbox.kind_of?(Mailbox) ? mailbox : Mailbox.new(connection, mailbox)
45
- @flags = []
45
+ @flags = args.has_key?(:flags) ? Array(args[:flags]) : []
46
46
  @date = args[:date] || Time.now
47
47
  @template = args[:template]
48
48
  @message_id = args[:message_id] || "<#{UUIDTools::UUID.random_create}@test.oib.com>"
@@ -72,7 +72,7 @@ module Luggage
72
72
  #
73
73
  def save!
74
74
  mailbox.select!
75
- connection.append(mailbox.name, raw_message, flags.map {|f| f.to_sym.upcase}, date)
75
+ connection.append(mailbox.name, raw_message, flags, date)
76
76
  end
77
77
 
78
78
  # Uses IMAP's COPY command to copy the message into the named mailbox
@@ -94,7 +94,7 @@ module Luggage
94
94
  #
95
95
  def exists?
96
96
  mailbox.select!
97
- connection.uid_search("HEADER Message-ID #{message_id}")
97
+ connection.uid_search("HEADER.PEEK Message-ID #{message_id}")
98
98
  end
99
99
 
100
100
  # Proxy all other methods to this instance's Mail::Message
@@ -1,3 +1,3 @@
1
1
  module Luggage
2
- VERSION = "1.2.1"
2
+ VERSION = "1.2.2"
3
3
  end
@@ -84,5 +84,14 @@ describe Luggage::Factory do
84
84
  expect(factory.mailboxes[1..2].map(&:name)).to eq(["Mailbox_2", "Mailbox_3"])
85
85
  end
86
86
  end
87
+
88
+ context "with a string argument (function-call syntax) and a block" do
89
+ it "executes the block in the mailbox's scope" do
90
+ Luggage::Mailbox.any_instance.should_receive(:message)
91
+ factory.mailboxes("Mailbox_1") do
92
+ message
93
+ end
94
+ end
95
+ end
87
96
  end
88
97
  end
@@ -39,6 +39,20 @@ describe Luggage::Message do
39
39
  Luggage::Message.new_local(connection, :mailbox, :template =>"base")
40
40
  end
41
41
  end
42
+
43
+ context "with flags passed as argument" do
44
+ it "sets flags" do
45
+ message = Luggage::Message.new_local(connection, :mailbox, :flags => :Seen)
46
+ expect(message.flags).to include(:Seen)
47
+ end
48
+ end
49
+
50
+ context "with flags array passed as argument" do
51
+ it "sets flags" do
52
+ message = Luggage::Message.new_local(connection, :mailbox, :flags => [:Seen])
53
+ expect(message.flags).to include(:Seen)
54
+ end
55
+ end
42
56
  end
43
57
 
44
58
  describe "::new" do
@@ -89,7 +103,7 @@ describe Luggage::Message do
89
103
 
90
104
  it "fetches raw email" do
91
105
  connection.should_receive(:uid_fetch).
92
- with([1], ["FLAGS", "INTERNALDATE", "BODY.PEEK[]"]).
106
+ with([1], ["FLAGS", "INTERNALDATE.PEEK", "BODY.PEEK[]"]).
93
107
  and_return( [{:attr => {"BODY[]" => "raw_body", "FLAGS" => [], "INTERNALDATE" => (Time.now - 60 * 60 * 24).to_s}}] )
94
108
 
95
109
  message.reload
@@ -97,7 +111,7 @@ describe Luggage::Message do
97
111
 
98
112
  it "fetches flags" do
99
113
  connection.should_receive(:uid_fetch).
100
- with([1], ["FLAGS", "INTERNALDATE", "BODY.PEEK[]"]).
114
+ with([1], ["FLAGS", "INTERNALDATE.PEEK", "BODY.PEEK[]"]).
101
115
  and_return( [{:attr => {"BODY[]" => "raw_body", "FLAGS" => [], "INTERNALDATE" => (Time.now - 60 * 60 * 24).to_s}}] )
102
116
 
103
117
  message.reload
@@ -165,7 +179,7 @@ describe Luggage::Message do
165
179
 
166
180
  it "searches for message with message_id" do
167
181
  message.stub(:message_id).and_return("<foo@example.com>")
168
- connection.should_receive(:uid_search).with("HEADER Message-ID <foo@example.com>").and_return([1])
182
+ connection.should_receive(:uid_search).with("HEADER.PEEK Message-ID <foo@example.com>").and_return([1])
169
183
 
170
184
  message.exists?
171
185
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luggage
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Ryan Michael
@@ -9,11 +10,12 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-03-15 00:00:00.000000000 Z
13
+ date: 2013-03-19 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: mail
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
20
  - - ~>
19
21
  - !ruby/object:Gem::Version
@@ -21,6 +23,7 @@ dependencies:
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
28
  - - ~>
26
29
  - !ruby/object:Gem::Version
@@ -28,6 +31,7 @@ dependencies:
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: uuidtools
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
36
  - - ~>
33
37
  - !ruby/object:Gem::Version
@@ -35,6 +39,7 @@ dependencies:
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
44
  - - ~>
40
45
  - !ruby/object:Gem::Version
@@ -42,6 +47,7 @@ dependencies:
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: bundler
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
52
  - - ~>
47
53
  - !ruby/object:Gem::Version
@@ -49,6 +55,7 @@ dependencies:
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
60
  - - ~>
54
61
  - !ruby/object:Gem::Version
@@ -56,6 +63,7 @@ dependencies:
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: rake
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
68
  - - ~>
61
69
  - !ruby/object:Gem::Version
@@ -63,6 +71,7 @@ dependencies:
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
76
  - - ~>
68
77
  - !ruby/object:Gem::Version
@@ -70,6 +79,7 @@ dependencies:
70
79
  - !ruby/object:Gem::Dependency
71
80
  name: rdoc
72
81
  requirement: !ruby/object:Gem::Requirement
82
+ none: false
73
83
  requirements:
74
84
  - - ~>
75
85
  - !ruby/object:Gem::Version
@@ -77,6 +87,7 @@ dependencies:
77
87
  type: :development
78
88
  prerelease: false
79
89
  version_requirements: !ruby/object:Gem::Requirement
90
+ none: false
80
91
  requirements:
81
92
  - - ~>
82
93
  - !ruby/object:Gem::Version
@@ -84,6 +95,7 @@ dependencies:
84
95
  - !ruby/object:Gem::Dependency
85
96
  name: rspec
86
97
  requirement: !ruby/object:Gem::Requirement
98
+ none: false
87
99
  requirements:
88
100
  - - ~>
89
101
  - !ruby/object:Gem::Version
@@ -91,6 +103,7 @@ dependencies:
91
103
  type: :development
92
104
  prerelease: false
93
105
  version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
94
107
  requirements:
95
108
  - - ~>
96
109
  - !ruby/object:Gem::Version
@@ -98,6 +111,7 @@ dependencies:
98
111
  - !ruby/object:Gem::Dependency
99
112
  name: activesupport
100
113
  requirement: !ruby/object:Gem::Requirement
114
+ none: false
101
115
  requirements:
102
116
  - - ~>
103
117
  - !ruby/object:Gem::Version
@@ -105,6 +119,7 @@ dependencies:
105
119
  type: :development
106
120
  prerelease: false
107
121
  version_requirements: !ruby/object:Gem::Requirement
122
+ none: false
108
123
  requirements:
109
124
  - - ~>
110
125
  - !ruby/object:Gem::Version
@@ -112,6 +127,7 @@ dependencies:
112
127
  - !ruby/object:Gem::Dependency
113
128
  name: fuubar
114
129
  requirement: !ruby/object:Gem::Requirement
130
+ none: false
115
131
  requirements:
116
132
  - - ~>
117
133
  - !ruby/object:Gem::Version
@@ -119,6 +135,7 @@ dependencies:
119
135
  type: :development
120
136
  prerelease: false
121
137
  version_requirements: !ruby/object:Gem::Requirement
138
+ none: false
122
139
  requirements:
123
140
  - - ~>
124
141
  - !ruby/object:Gem::Version
@@ -126,6 +143,7 @@ dependencies:
126
143
  - !ruby/object:Gem::Dependency
127
144
  name: pry
128
145
  requirement: !ruby/object:Gem::Requirement
146
+ none: false
129
147
  requirements:
130
148
  - - ~>
131
149
  - !ruby/object:Gem::Version
@@ -133,6 +151,7 @@ dependencies:
133
151
  type: :development
134
152
  prerelease: false
135
153
  version_requirements: !ruby/object:Gem::Requirement
154
+ none: false
136
155
  requirements:
137
156
  - - ~>
138
157
  - !ruby/object:Gem::Version
@@ -169,26 +188,27 @@ files:
169
188
  homepage: https://github.com/otherinbox/luggage
170
189
  licenses:
171
190
  - MIT
172
- metadata: {}
173
191
  post_install_message:
174
192
  rdoc_options: []
175
193
  require_paths:
176
194
  - lib
177
195
  required_ruby_version: !ruby/object:Gem::Requirement
196
+ none: false
178
197
  requirements:
179
- - - '>='
198
+ - - ! '>='
180
199
  - !ruby/object:Gem::Version
181
200
  version: '0'
182
201
  required_rubygems_version: !ruby/object:Gem::Requirement
202
+ none: false
183
203
  requirements:
184
- - - '>='
204
+ - - ! '>='
185
205
  - !ruby/object:Gem::Version
186
206
  version: '0'
187
207
  requirements: []
188
208
  rubyforge_project:
189
- rubygems_version: 2.0.3
209
+ rubygems_version: 1.8.23
190
210
  signing_key:
191
- specification_version: 4
211
+ specification_version: 3
192
212
  summary: Net::IMAP DSL
193
213
  test_files:
194
214
  - spec/luggage/factory_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 56d02cbdf3e91765d32a9e9e31d1044f3bc2205f
4
- data.tar.gz: 39548bc74936a200a7b63c8c8ddaad8b59e1119a
5
- SHA512:
6
- metadata.gz: 84ee01e2b3bd73119fddf71f3cc4b8ef0ea3a7cc0dbf5935867e7128b5974af1363627c5c24dcd497c9f9de5f3f0fa40220797fbaa0baf4dd2429c981c24b690
7
- data.tar.gz: 1eb4a73055793e3b0fd091586d5887ac628e1165cef0b0cd4c0bb5e409bc744fb5af27cc7fe6b21b39f076c9b62ce9cf1f42692e64768605314b1c28b97d882a