Sha256: 8ea898a8e8eb90d38c8690f82948a5d3d51e71e6158acc31009690c44115e34c

Contents?: true

Size: 857 Bytes

Versions: 29

Compression:

Stored size: 857 Bytes

Contents

require 'functional_spec_helper'

describe 'Pushy' do
  let(:external_device_id) { '5a622ae5813e2875bfdbe496' }
  let(:response) { instance_double('Net::HTTPResponse', code: 200, body: { id: external_device_id }.to_json) }
  let(:http) { instance_double('Net::HTTP::Persistent', request: response, shutdown: nil) }
  let(:app) { Rpush::Pushy::App.create!(name: 'MyApp', api_key: 'my_api_key') }

  let(:notification) do
    Rpush::Pushy::Notification.create!(app: app, data: { message: 'test' }, registration_ids: ['id'])
  end

  before do
    allow(Net::HTTP::Persistent).to receive_messages(new: http)
  end

  it 'deliveres a notification successfully' do
    expect { Rpush.push }.to change { notification.reload.delivered }.to(true)
  end

  it { expect { Rpush.push }.to change { notification.reload.external_device_id }.to(external_device_id) }
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
rpush_extended-3.2.6 spec/functional/pushy_spec.rb
rpush_extended-3.2.5 spec/functional/pushy_spec.rb
rpush-3.2.4 spec/functional/pushy_spec.rb
rpush-3.2.3 spec/functional/pushy_spec.rb
rpush-3.2.2 spec/functional/pushy_spec.rb
rpush-3.2.1 spec/functional/pushy_spec.rb
rpush-3.2.0 spec/functional/pushy_spec.rb
rpush-3.1.1 spec/functional/pushy_spec.rb
rpush-3.1.0 spec/functional/pushy_spec.rb