facteur 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -56,14 +56,16 @@ module Facteur
56
56
  # # send a message to many addressees
57
57
  # @john.send_message('message contents', :to => [@peter, @james], :in => :private_mailbox)
58
58
  def send_message(message, options)
59
+ msg = nil
59
60
  options[:body] = message
60
61
  if options[:to].is_a? Array
61
62
  options[:to].each do |addressee|
62
- send_message_to(addressee, options[:in], options[:body], options[:subject])
63
+ msg = send_message_to(addressee, options[:in], options[:body], options[:subject])
63
64
  end
64
65
  else
65
- send_message_to(options[:to], options[:in], options[:body], options[:subject])
66
+ msg = send_message_to(options[:to], options[:in], options[:body], options[:subject])
66
67
  end
68
+ msg
67
69
  end
68
70
 
69
71
  # Creates a new mailbox. if a mailbox with the same name already exists, it fails and returns false. If succeeded, it creates an accessor for the new mail box and returns true.
@@ -129,6 +131,7 @@ module Facteur
129
131
  message.body = contents
130
132
  message.subject = subject
131
133
  message.save
134
+ message
132
135
  end
133
136
  end
134
137
  end
data/spec/facteur_spec.rb CHANGED
@@ -72,21 +72,18 @@ describe Facteur::AddresseeModel do
72
72
  end
73
73
 
74
74
  it "sends a message to another addressee" do
75
- @john.send_message('message contents', :to => @peter, :in => :private_mailbox).should == true
76
- message = @peter.private_mailbox.messages.last
75
+ message = @john.send_message('message contents', :to => @peter, :in => :private_mailbox)
77
76
  message.author.should == @john
78
77
  message.body.should == 'message contents'
79
78
 
80
- @john.send_message('message contents', :to => @peter, :in => :private_mailbox, :subject => 'test').should == true
81
- message = @peter.private_mailbox.messages.last
79
+ message = @john.send_message('message contents', :to => @peter, :in => :private_mailbox, :subject => 'test')
82
80
  message.author.should == @john
83
81
  message.body.should == 'message contents'
84
82
  message.subject.should == 'test'
85
83
  end
86
84
 
87
85
  it "sends the messages in the default mailbox" do
88
- @john.send_message('message contents', :to => @peter).should == true
89
- message = @peter.private_mailbox.messages.last
86
+ message = @john.send_message('message contents', :to => @peter)
90
87
  message.author.should == @john
91
88
  message.body.should == 'message contents'
92
89
  end
@@ -100,7 +97,9 @@ describe Facteur::AddresseeModel do
100
97
  end
101
98
 
102
99
  it "sends a message to many addressees" do
103
- @john.send_message('message contents', :to => [@peter, @james, @jane], :in => :private_mailbox)
100
+ message = @john.send_message('message contents', :to => [@peter, @james, @jane], :in => :private_mailbox)
101
+ message.author.should == @john
102
+ message.body.should == 'message contents'
104
103
 
105
104
  message = @peter.private_mailbox.messages.last
106
105
  message.author.should == @john
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 1
7
8
  - 0
8
- - 0
9
- version: 1.0.0
9
+ version: 1.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rawane ZOSSOU
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-12 00:00:00 +02:00
17
+ date: 2010-09-16 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -64,8 +64,8 @@ homepage: http://github.com/raw1z/facteur
64
64
  licenses: []
65
65
 
66
66
  post_install_message:
67
- rdoc_options:
68
- - --charset=UTF-8
67
+ rdoc_options: []
68
+
69
69
  require_paths:
70
70
  - lib
71
71
  required_ruby_version: !ruby/object:Gem::Requirement