freya 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f01369cd30ce22394b543d5dc6b12b0141ac7569
4
- data.tar.gz: add304557f6143949a50e172842d90e0986b214b
3
+ metadata.gz: 51e3de6fb2d29a2ba54199a69e91463f57548797
4
+ data.tar.gz: 8b2150b89c632d9113996a573ae44d39b88a57d5
5
5
  SHA512:
6
- metadata.gz: bfd10d236ddd8019f60fb11c6e56dda25bd8ec2aa7a3b2d5e64cc4f883130229caab866730d89ce753404ac428d19671fca003b3aa6b70ab2700958c11503b92
7
- data.tar.gz: 4949fa431988eae9640baadfe809c51c3f0179833707ff6a5053bdccb477c9ecf36b074dd2d235891a9039e9af149ae5c605925eeef7a74b43b1f866ef5a0163
6
+ metadata.gz: 39f04054521876c19d02c796ad7bb9a1103a3d552687e6efd145cb3dbc30f2b6439665191dffd13d4b9bccd8257697af2804957565b1793b62ff4e266f4c6370
7
+ data.tar.gz: f0240b5f61ed76907cd9219c0ec14f69ea0f68ba17c00a9483158296d6dab2c4a56bc587934c0b72563c25e4ac853b327c22444bf1c5ff98a27e360e999feba3
@@ -23,18 +23,7 @@ module Freya
23
23
  end
24
24
  end
25
25
 
26
- class Email
27
- attr_accessor :name, :to, :subject, :cc, :bcc
28
- cattr_accessor :cc, :bcc
29
-
30
- def initialize(options = {})
31
- @name = options[:name]
32
- @to = options[:to]
33
- @subject = options[:subject]
34
- @cc = options[:cc]
35
- @bcc = options[:bcc]
36
- end
37
-
26
+ class Email < OpenStruct
38
27
  def link
39
28
  extras = %w{ cc bcc body subject }.select { |extra| send(extra).present? }.map { |extra| [extra, send(extra)] }.map { |extra|
40
29
  name = extra[0]
@@ -56,11 +45,11 @@ module Freya
56
45
  end
57
46
 
58
47
  def cc
59
- self.class.cc.to_a + @cc.to_a - [to]
48
+ base_cc.to_a + self[:cc].to_a - [to]
60
49
  end
61
50
 
62
51
  def bcc
63
- self.class.bcc.to_a + @bcc.to_a - [to]
52
+ base_bcc.to_a + self[:bcc].to_a - [to]
64
53
  end
65
54
  end
66
55
  end
@@ -1,3 +1,3 @@
1
1
  module Freya
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -61,17 +61,25 @@ describe Freya::Email do
61
61
  end
62
62
  end
63
63
 
64
- describe '#self.cc' do
64
+ describe 'base_cc' do
65
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'])
66
+ Freya::Email.new(
67
+ name: 'test_email',
68
+ to: 'test@test.com',
69
+ cc: ['test@test.com','test2@test.com'],
70
+ base_cc: ['base_email@test.com']
71
+ ).cc.should eq(['base_email@test.com', 'test2@test.com'])
68
72
  end
69
73
  end
70
74
 
71
- describe '#self.bcc' do
75
+ describe 'base_bcc' do
72
76
  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'])
77
+ Freya::Email.new(
78
+ name: 'test_email',
79
+ to: 'test@test.com',
80
+ bcc: ['test@test.com','test1@test.com'],
81
+ base_bcc: ['base_email@test.com']
82
+ ).bcc.should eq(['base_email@test.com', 'test1@test.com'])
75
83
  end
76
84
  end
77
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freya
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matteo Depalo