freya 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/freya.rb +5 -4
- data/lib/freya/version.rb +1 -1
- data/spec/freya_spec.rb +14 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f01369cd30ce22394b543d5dc6b12b0141ac7569
|
4
|
+
data.tar.gz: add304557f6143949a50e172842d90e0986b214b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfd10d236ddd8019f60fb11c6e56dda25bd8ec2aa7a3b2d5e64cc4f883130229caab866730d89ce753404ac428d19671fca003b3aa6b70ab2700958c11503b92
|
7
|
+
data.tar.gz: 4949fa431988eae9640baadfe809c51c3f0179833707ff6a5053bdccb477c9ecf36b074dd2d235891a9039e9af149ae5c605925eeef7a74b43b1f866ef5a0163
|
data/lib/freya.rb
CHANGED
@@ -25,13 +25,14 @@ module Freya
|
|
25
25
|
|
26
26
|
class Email
|
27
27
|
attr_accessor :name, :to, :subject, :cc, :bcc
|
28
|
+
cattr_accessor :cc, :bcc
|
28
29
|
|
29
30
|
def initialize(options = {})
|
30
31
|
@name = options[:name]
|
31
32
|
@to = options[:to]
|
32
33
|
@subject = options[:subject]
|
33
|
-
@cc = options[:cc]
|
34
|
-
@bcc = options[:bcc]
|
34
|
+
@cc = options[:cc]
|
35
|
+
@bcc = options[:bcc]
|
35
36
|
end
|
36
37
|
|
37
38
|
def link
|
@@ -55,11 +56,11 @@ module Freya
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def cc
|
58
|
-
@cc - [to]
|
59
|
+
self.class.cc.to_a + @cc.to_a - [to]
|
59
60
|
end
|
60
61
|
|
61
62
|
def bcc
|
62
|
-
@bcc - [to]
|
63
|
+
self.class.bcc.to_a + @bcc.to_a - [to]
|
63
64
|
end
|
64
65
|
end
|
65
66
|
end
|
data/lib/freya/version.rb
CHANGED
data/spec/freya_spec.rb
CHANGED
@@ -60,6 +60,20 @@ describe Freya::Email do
|
|
60
60
|
Freya::Email.new(name: 'test_email', to: 'test@test.com', bcc: ['test@test.com', 'test1@test.com']).bcc.should eq(['test1@test.com'])
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
describe '#self.cc' do
|
65
|
+
it 'contains the base ccs' do
|
66
|
+
Freya::Email.stub(cc: ['base_email@test.com'])
|
67
|
+
Freya::Email.new(name: 'test_email', to: 'test@test.com', cc: ['test@test.com', 'test2@test.com']).cc.should eq(['base_email@test.com', 'test2@test.com'])
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe '#self.bcc' do
|
72
|
+
it 'contains the base bccs' do
|
73
|
+
Freya::Email.stub(bcc: ['base_email@test.com'])
|
74
|
+
Freya::Email.new(name: 'test_email', to: 'test@test.com', bcc: ['test@test.com', 'test1@test.com']).bcc.should eq(['base_email@test.com', 'test1@test.com'])
|
75
|
+
end
|
76
|
+
end
|
63
77
|
end
|
64
78
|
|
65
79
|
describe Freya::Template do
|