Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed fcm spec #77

Merged
merged 2 commits into from
Jun 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ rvm:
- 2.5
- 2.6
before_install:
- |
if [[ ${RUBY_VERSION} =~ ^ruby-2.5 ]]; then
gem uninstall -i /home/travis/.rvm/gems/${RUBY_VERSION}@global bundler -x
fi
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
- gem install bundler -v 1.17.3
before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
Expand Down
2 changes: 1 addition & 1 deletion lib/webpush/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
module Webpush
# It is temporary URL until supported by the GCM server.
GCM_URL = 'https://android.googleapis.com/gcm/send'.freeze
TEMP_GCM_URL = 'https://fcm.googleapis.com/fcm/'.freeze
TEMP_GCM_URL = 'https://fcm.googleapis.com/fcm'.freeze

# rubocop:disable Metrics/ClassLength
class Request
Expand Down
4 changes: 2 additions & 2 deletions spec/webpush/request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def build_request_with_api_key(endpoint, options = {})
expect(request.headers['Authorization']).to eq('key=api_key')
end

it 'does not insert Authorization header for Chrome\'s new standards-compliant endpoints, even if api_key is present' do
it 'insert Authorization header for Chrome\'s new standards-compliant endpoints, even if api_key is present' do
request = build_request_with_api_key('https://fcm.googleapis.com/fcm/send/ABCD1234', api_key: 'api_key')

expect(request.headers['Authorization']).to be_nil
expect(request.headers['Authorization']).to eq('key=api_key')
end

it 'does not insert Authorization header when endpoint is not for Chrome, even if api_key is present' do
Expand Down
2 changes: 1 addition & 1 deletion spec/webpush_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@

context 'chrome GCM endpoint: request headers with GCM api key' do
let(:endpoint) { 'https://android.googleapis.com/gcm/send/subscription-id' }
let(:expected_endpoint) { 'https://gcm-http.googleapis.com/gcm/subscription-id' }
let(:expected_endpoint) { 'https://fcm.googleapis.com/fcm/subscription-id' }

let(:message) { JSON.generate(body: 'body') }
let(:p256dh) { 'BN4GvZtEZiZuqFxSKVZfSfluwKBD7UxHNBmWkfiZfCtgDE8Bwh-_MtLXbBxTBAWH9r7IPKL0lhdcaqtL1dfxU5E=' }
Expand Down