Sha256: 8ea898a8e8eb90d38c8690f82948a5d3d51e71e6158acc31009690c44115e34c

Contents?: true

Size: 857 Bytes

Versions: 28

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

28 entries across 28 versions & 2 rubygems

Version Path
rpush-9.1.0 spec/functional/pushy_spec.rb
rpush-9.0.0 spec/functional/pushy_spec.rb
rpush-8.0.0 spec/functional/pushy_spec.rb
rpush-7.0.1 spec/functional/pushy_spec.rb
rpush-7.0.0 spec/functional/pushy_spec.rb
rpush-6.0.1 spec/functional/pushy_spec.rb
rpush-6.0.0 spec/functional/pushy_spec.rb
rpush-5.4.0 spec/functional/pushy_spec.rb
rpush-5.3.0 spec/functional/pushy_spec.rb
rpush-5.2.0 spec/functional/pushy_spec.rb
rpush-5.1.0 spec/functional/pushy_spec.rb
rpush-5.0.0 spec/functional/pushy_spec.rb
rpush-4.2.0 spec/functional/pushy_spec.rb
rpush-4.1.1 spec/functional/pushy_spec.rb
rpush-4.1.0 spec/functional/pushy_spec.rb
rpush-4.0.1 spec/functional/pushy_spec.rb
rpush-4.0.0 spec/functional/pushy_spec.rb
rpush-3.3.1 spec/functional/pushy_spec.rb
rpush-3.3.0 spec/functional/pushy_spec.rb
rpush_extended-3.2.6 spec/functional/pushy_spec.rb