trabajo-afectivo/test/data/twitter/webhook_events/favorited.yml
Ryan Lue 64c882b090 Refactoring: Add coverage for TwitterSync#process_webhook
Prior to this commit,
the TwitterSync#process_webhook method had only partial test coverage
(in `spec/requests/integration/twitter_webhook_spec.rb`).
This commit replaces the existing, incomplete tests
with a direct spec of the TwitterSync class,
giving individual test cases for all reasonable edge cases
of the #process_webhook method.

Since this method is responsible for a lot of complex behavior,
there are a _lot_ of such test cases.
Putting them all in the same spec file makes it hard to read through,
so a future goal is to break them up into smaller methods
and move some of these methods into other, more appropriate classes.

This could not be achieved with a request spec,
since they enforce testing at a single interface /
level of abstraction (i.e., HTTP requests).

=== Note: This commit will not pass CI.

Some bugs in the existing code were uncovered
in the process of adding comprehensive test coverage
for the #process_webhook method.

In the interest of isolating changes into discrete chunks, fixes for
these bugs have been reserved for the next commit.
2020-04-28 13:40:14 +02:00

127 lines
4.3 KiB
YAML

--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
for_user_id: '2975699229'
favorite_events:
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
id: 306365f99a761d92af4753775e89f7a4
created_at: Mon Dec 16 23:49:59 +0000 2019
timestamp_ms: 1576540199643
favorited_status: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
created_at: Mon Dec 16 12:20:39 +0000 2019
id: 1206549698791657473
id_str: '1206549698791657473'
text: https://t.co/qywSsecZ1I is now running on Falcon.
source: <a href="https://mobile.twitter.com" rel="nofollow">Twitter Web App</a>
truncated: false
in_reply_to_status_id:
in_reply_to_status_id_str:
in_reply_to_user_id:
in_reply_to_user_id_str:
in_reply_to_screen_name:
user: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
id: 28451785
id_str: '28451785'
name: Samuel Williams
screen_name: ioquatix
location: Christchurch, New Zealand
url: http://www.codeotaku.com
description: '"A candle loses nothing by lighting another"'
translator_type: none
protected: false
verified: false
followers_count: 574
friends_count: 149
listed_count: 22
favourites_count: 1683
statuses_count: 1467
created_at: Thu Apr 02 23:52:51 +0000 2009
utc_offset:
time_zone:
geo_enabled: true
lang:
contributors_enabled: false
is_translator: false
profile_background_color: '000000'
profile_background_image_url: http://abs.twimg.com/images/themes/theme5/bg.gif
profile_background_image_url_https: https://abs.twimg.com/images/themes/theme5/bg.gif
profile_background_tile: true
profile_link_color: '000000'
profile_sidebar_border_color: 4025AD
profile_sidebar_fill_color: DEF0FF
profile_text_color: '000000'
profile_use_background_image: true
profile_image_url: http://pbs.twimg.com/profile_images/1343681082/Chi_Keyboard_normal.png
profile_image_url_https: https://pbs.twimg.com/profile_images/1343681082/Chi_Keyboard_normal.png
profile_banner_url: https://pbs.twimg.com/profile_banners/28451785/1353638161
default_profile: false
default_profile_image: false
following:
follow_request_sent:
notifications:
geo:
coordinates:
place:
contributors:
is_quote_status: false
quote_count: 0
reply_count: 0
retweet_count: 4
favorite_count: 36
entities: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
hashtags: []
urls:
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
url: https://t.co/qywSsecZ1I
expanded_url: https://rubyapi.org
display_url: rubyapi.org
indices:
- 0
- 23
user_mentions: []
symbols: []
favorited: false
retweeted: false
possibly_sensitive: false
filter_level: low
lang: en
user: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
id: 2975699229
id_str: '2975699229'
name: Ryan Lue
screen_name: ScruffyMcG
location: Taipei
url: http://ryanlue.com
description: I like turtles.
translator_type: none
protected: false
verified: false
followers_count: 30
friends_count: 56
listed_count: 0
favourites_count: 20
statuses_count: 6
created_at: Tue Jan 13 02:38:37 +0000 2015
utc_offset:
time_zone:
geo_enabled: false
lang:
contributors_enabled: false
is_translator: false
profile_background_color: C0DEED
profile_background_image_url: http://abs.twimg.com/images/themes/theme1/bg.png
profile_background_image_url_https: https://abs.twimg.com/images/themes/theme1/bg.png
profile_background_tile: false
profile_link_color: 1DA1F2
profile_sidebar_border_color: C0DEED
profile_sidebar_fill_color: DDEEF6
profile_text_color: '333333'
profile_use_background_image: true
profile_image_url: http://pbs.twimg.com/profile_images/877073703330238464/fnxECj4z_normal.jpg
profile_image_url_https: https://pbs.twimg.com/profile_images/877073703330238464/fnxECj4z_normal.jpg
profile_banner_url: https://pbs.twimg.com/profile_banners/2975699229/1497946434
default_profile: true
default_profile_image: false
following:
follow_request_sent:
notifications:
controller: channels_twitter
action: webhook_incoming