mercurius 0.0.8 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 498d9587f0f19766323fbbf7ab3639f0a7de891d
4
- data.tar.gz: 776032be932fcd0709cabe7fc00ac43bfa194095
3
+ metadata.gz: 0fff5a024bedc9602172b080681a4ed8b28f8d45
4
+ data.tar.gz: 06d8f0cd9206fc23c70cf66e48c2c1912bd3458e
5
5
  SHA512:
6
- metadata.gz: 3b37c90492d303de86eb2f63a0710f572cd32c3397e24069fba6f72389e13130db4212209778e238c28796de98f3e420503f72ae1860eb9b825d3873721c89bc
7
- data.tar.gz: e1e1b54c88e0c7d7e965bf0c0f5aa0f0a479e5bdab8e5ba8ee8e0f08ae3f47f6cbb42b34dfe9fb5b219d882f0eb2871834678bc7202a49cf1e84e6cd4a29115c
6
+ metadata.gz: 66e282ada6fef6296cf21380105f067aae9a54c27e0f0058f28b1fe467fc6595531c1aa7eef4d16017fb675ed4ef276522752436d557ef2fae0a206c40b6abb7
7
+ data.tar.gz: 8caff3a87dd456736a0777607998f75a5e8b3a3dd1ef7cc2b280b776b05ac2c3bf05b4de8496050d42aefa7ebe8a2165e6ca3f8070ae4bc673ffc3228de54ede
@@ -0,0 +1,28 @@
1
+ module Mercurius
2
+ module Testing
3
+ class Result
4
+ attr_reader :responses
5
+
6
+ def initialize(notification)
7
+ @notification = notification
8
+ @responses = []
9
+ end
10
+
11
+ def success?
12
+ true
13
+ end
14
+
15
+ def process_response(*)
16
+ end
17
+
18
+ def failed_responses
19
+ []
20
+ end
21
+
22
+ def failed_device_tokens
23
+ []
24
+ end
25
+
26
+ end
27
+ end
28
+ end
@@ -4,6 +4,7 @@ module Mercurius
4
4
 
5
5
  def deliver(notification, *device_tokens)
6
6
  Mercurius::Testing::Base.deliveries << Mercurius::Testing::Delivery.new(notification, Array(device_tokens).flatten)
7
+ Mercurius::Testing::Result.new notification
7
8
  end
8
9
 
9
10
  end
@@ -1,5 +1,6 @@
1
1
  require 'mercurius/testing/base'
2
2
  require 'mercurius/testing/delivery'
3
+ require 'mercurius/testing/result'
3
4
  require 'mercurius/testing/service'
4
5
 
5
6
  APNS::Service.send :prepend, Mercurius::Testing::Service
@@ -1,3 +1,3 @@
1
1
  module Mercurius
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -1,6 +1,6 @@
1
- require File.expand_path('../../../lib/mercurius/testing/service', __FILE__)
2
- require File.expand_path('../../../lib/mercurius/testing/base', __FILE__)
3
- require File.expand_path('../../../lib/mercurius/testing/delivery', __FILE__)
1
+ %w(service base result delivery).each do |rb|
2
+ require File.expand_path("../../../lib/mercurius/testing/#{rb}", __FILE__)
3
+ end
4
4
 
5
5
  describe 'Test mode' do
6
6
 
@@ -21,10 +21,11 @@ describe 'Test mode' do
21
21
  let(:message) { GCM::Notification.new(alert: 'Hey') }
22
22
 
23
23
  it 'returns the deliveries sent to GCM' do
24
- service.deliver message, 'token123'
24
+ result = service.deliver message, 'token123'
25
25
  delivery = Mercurius::Testing::Base.deliveries[0]
26
26
  expect(delivery.device_tokens).to include 'token123'
27
27
  expect(delivery.notification.data).to eq Hash[alert: 'Hey']
28
+ expect(result).to be_a_kind_of Mercurius::Testing::Result
28
29
  end
29
30
  end
30
31
 
@@ -33,10 +34,11 @@ describe 'Test mode' do
33
34
  let(:message) { APNS::Notification.new(alert: 'Hey') }
34
35
 
35
36
  it 'returns the deliveries sent to APNS' do
36
- service.deliver message, 'token123'
37
+ result = service.deliver message, 'token123'
37
38
  delivery = Mercurius::Testing::Base.deliveries[0]
38
39
  expect(delivery.device_tokens).to include 'token123'
39
40
  expect(delivery.notification.alert).to eq 'Hey'
41
+ expect(result).to be_a_kind_of Mercurius::Testing::Result
40
42
  end
41
43
  end
42
44
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mercurius
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Beck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-02 00:00:00.000000000 Z
11
+ date: 2015-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -157,6 +157,7 @@ files:
157
157
  - lib/mercurius/testing.rb
158
158
  - lib/mercurius/testing/base.rb
159
159
  - lib/mercurius/testing/delivery.rb
160
+ - lib/mercurius/testing/result.rb
160
161
  - lib/mercurius/testing/service.rb
161
162
  - lib/mercurius/version.rb
162
163
  - mercurius.gemspec