facteur 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +1 -0
- data/VERSION +1 -1
- data/lib/facteur/addressee_model.rb +3 -0
- data/spec/facteur_spec.rb +39 -0
- data/spec/spec_helper.rb +1 -0
- metadata +3 -3
data/README.markdown
CHANGED
@@ -69,6 +69,7 @@ It is also possible to create a mailbox dynamically. This mailbox will not be av
|
|
69
69
|
|
70
70
|
@john.create_mailbox(:new_mailbox) #=> true
|
71
71
|
User.mailboxes #=> [{:name=>:private_mailbox, :default=>true}, {:name=>:public_mailbox}]
|
72
|
+
@john.mailboxes #=> [{:name=>:private_mailbox, :default=>true}, {:name=>:public_mailbox}, {:name=>:new_mailbox}]
|
72
73
|
|
73
74
|
After the previous example, the "news\_mailbox" is only avalaible to John. The names of the mailboxes must be unique. if you try to create a mailbox which already exists, the create_mailbox() method will return false.
|
74
75
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/spec/facteur_spec.rb
CHANGED
@@ -86,4 +86,43 @@ describe Facteur::AddresseeModel do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
context "When adding a new mailbox" do
|
90
|
+
before(:all) do
|
91
|
+
create_users
|
92
|
+
class User < ActiveRecord::Base
|
93
|
+
mailbox :added_mailbox
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should add the new mailbox to the class mailboxes" do
|
98
|
+
User.mailboxes.should include({:name=>:added_mailbox})
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should add the new mailbox to all the existing users" do
|
102
|
+
@john.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
103
|
+
@john.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
104
|
+
@john.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
105
|
+
|
106
|
+
@peter.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
107
|
+
@peter.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
108
|
+
@peter.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
109
|
+
|
110
|
+
@james.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
111
|
+
@james.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
112
|
+
@james.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
113
|
+
|
114
|
+
@mary.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
115
|
+
@mary.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
116
|
+
@mary.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
117
|
+
|
118
|
+
@jane.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
119
|
+
@jane.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
120
|
+
@jane.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
121
|
+
|
122
|
+
@victoria.mailboxes.where(:name => 'private_mailbox').first.should_not be_nil
|
123
|
+
@victoria.mailboxes.where(:name => 'public_mailbox').first.should_not be_nil
|
124
|
+
@victoria.mailboxes.where(:name => 'added_mailbox').first.should_not be_nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
89
128
|
end
|
data/spec/spec_helper.rb
CHANGED