|
36 | 36 |
|
37 | 37 | let(:send_v1_params) do |
38 | 38 | { |
39 | | - "token" => "4sdsx", |
40 | | - "notification" => { |
41 | | - "title" => "Breaking News", |
42 | | - "body" => "New news story available." |
| 39 | + 'token' => '4sdsx', |
| 40 | + 'notification' => { |
| 41 | + 'title' => 'Breaking News', |
| 42 | + 'body' => 'New news story available.' |
43 | 43 | }, |
44 | | - "data" => { |
45 | | - "story_id" => "story_12345" |
| 44 | + 'data' => { |
| 45 | + 'story_id' => 'story_12345' |
46 | 46 | }, |
47 | | - "android" => { |
48 | | - "notification" => { |
49 | | - "click_action": "TOP_STORY_ACTIVITY", |
50 | | - "body" => "Check out the Top Story" |
| 47 | + 'android' => { |
| 48 | + 'notification' => { |
| 49 | + 'click_action' => 'TOP_STORY_ACTIVITY', |
| 50 | + 'body' => 'Check out the Top Story' |
51 | 51 | } |
52 | 52 | }, |
53 | | - "apns" => { |
54 | | - "payload" => { |
55 | | - "aps" => { |
56 | | - "category" => "NEW_MESSAGE_CATEGORY" |
| 53 | + 'apns' => { |
| 54 | + 'payload' => { |
| 55 | + 'aps' => { |
| 56 | + 'category' => 'NEW_MESSAGE_CATEGORY' |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | } |
61 | 61 | end |
62 | 62 |
|
63 | 63 | let(:valid_request_v1_body) do |
64 | | - { "message" => send_v1_params } |
| 64 | + { 'message' => send_v1_params } |
65 | 65 | end |
66 | 66 |
|
67 | 67 | let(:stub_fcm_send_v1_request) do |
68 | 68 | stub_request(:post, send_v1_url).with( |
69 | 69 | body: valid_request_v1_body.to_json, |
70 | | - headers: valid_request_v1_headers, |
| 70 | + headers: valid_request_v1_headers |
71 | 71 | ).to_return( |
72 | 72 | # ref: https://firebase.google.com/docs/cloud-messaging/http-server-ref#interpret-downstream |
73 | 73 | body: "{}", |
|
86 | 86 | stub_fcm_send_v1_request |
87 | 87 | end |
88 | 88 |
|
89 | | - it "should send notification of HTTP V1 using POST to FCM server" do |
| 89 | + it 'should send notification of HTTP V1 using POST to FCM server' do |
90 | 90 | fcm = FCM.new(api_key, json_key_path, project_name) |
91 | | - fcm.send_v1(send_v1_params).should eq(response: "success", body: "{}", headers: {}, status_code: 200) |
| 91 | + fcm.send_v1(send_v1_params).should eq( |
| 92 | + response: 'success', body: '{}', headers: {}, status_code: 200 |
| 93 | + ) |
92 | 94 | stub_fcm_send_v1_request.should have_been_made.times(1) |
93 | 95 | end |
94 | 96 | end |
|
0 commit comments