File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ class Message < Resource
44 include Operations ::Push
55
66 has_one :user , type : 'Userlist::Push::User'
7+ has_one :company , type : 'Userlist::Push::Company'
78
89 def initialize ( payload = { } , config = Userlist . config )
910 raise Userlist ::ArgumentError , 'Missing required payload' unless payload
Original file line number Diff line number Diff line change 55 {
66 template : 'template-identifier' ,
77 user : 'user-identifier' ,
8+ company : 'company-identifier' ,
89 properties : {
910 value : '$100.00'
1011 }
3940 expect ( subject . push? ) . to be_truthy
4041 end
4142 end
43+
44+ context 'when a company hash is given' do
45+ let ( :payload ) do
46+ super ( ) . merge (
47+ company : {
48+ identifier : 'company-identifier' ,
49+ name : 'Example Company'
50+ }
51+ )
52+ end
53+
54+ it 'should convert it into a company object' do
55+ expect ( subject . company ) . to be_kind_of ( Userlist ::Push ::Company )
56+ end
57+
58+ it 'should be pushable' do
59+ expect ( subject . push? ) . to be_truthy
60+ end
61+ end
4262end
You can’t perform that action at this time.
0 commit comments