File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
app/services/push_notifications
spec/services/push_notifications Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 9
9
10
10
client = Exponent ::Push ::Client . new
11
11
12
+ push_notifications . update_all ( processed_at : Time . now . utc )
12
13
client . publish ( notifications )
13
14
end
14
15
Original file line number Diff line number Diff line change 14
14
title : 'Hola'
15
15
)
16
16
end
17
+ let ( :push_notifications ) { PushNotification . all }
17
18
let ( :client ) { instance_double ( Exponent ::Push ::Client ) }
18
19
let ( :notification ) do
19
20
{
26
27
expect ( Exponent ::Push ::Client ) . to receive ( :new ) . and_return ( client )
27
28
expect ( client ) . to receive ( :publish ) . with ( [ notification ] )
28
29
29
- described_class . new ( push_notifications : [ push_notification ] ) . send
30
+ described_class . new ( push_notifications : push_notifications ) . send
31
+ end
32
+
33
+ it 'flags the push_notification as processed' do
34
+ allow ( Exponent ::Push ::Client ) . to receive ( :new ) . and_return ( client )
35
+ allow ( client ) . to receive ( :publish ) . with ( [ notification ] )
36
+
37
+ described_class . new ( push_notifications : push_notifications ) . send
38
+
39
+ expect ( push_notification . reload . processed_at ) . to_not be_nil
30
40
end
31
41
end
32
42
end
You can’t perform that action at this time.
0 commit comments