Skip to content

Commit 46a9fb6

Browse files
committed
Added a test for Strava::Webhooks::Models::Event.
1 parent ba0e087 commit 46a9fb6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
RSpec.describe Strava::Webhooks::Models::Event do
6+
let(:event_data) do
7+
{
8+
'aspect_type' => 'update',
9+
'event_time' => 1_516_126_040,
10+
'object_id' => 1_360_128_428,
11+
'object_type' => 'activity',
12+
'owner_id' => 134_815,
13+
'subscription_id' => 120_475,
14+
'updates' => {
15+
'title' => 'Messy'
16+
}
17+
}
18+
end
19+
20+
let(:event) { described_class.new(event_data) }
21+
22+
it 'parses event' do
23+
expect(event.id).to eq 1_360_128_428
24+
expect(event.aspect_type).to eq 'update'
25+
expect(event.event_time).to eq Time.at(1_516_126_040)
26+
expect(event.object_type).to eq 'activity'
27+
expect(event.owner_id).to eq 134_815
28+
expect(event.subscription_id).to eq 120_475
29+
expect(event.updates).to eq('title' => 'Messy')
30+
end
31+
end

0 commit comments

Comments
 (0)