trabajo-afectivo/test/data/twitter/webhook_events/tweet_create-user_mention_outgoing.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

85 lines
2.6 KiB
YAML

--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
for_user_id: '2975699229'
user_has_blocked: false
tweet_create_events:
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
created_at: Mon Dec 23 15:06:52 +0000 2019
id: 1209128243955027968
id_str: '1209128243955027968'
text: "@ScruffyMcG Who do you think you are?"
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: 2975699229
in_reply_to_user_id_str: '2975699229'
in_reply_to_screen_name: ScruffyMcG
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: 31
friends_count: 56
listed_count: 0
favourites_count: 20
statuses_count: 8
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:
geo:
coordinates:
place:
contributors:
is_quote_status: false
quote_count: 0
reply_count: 0
retweet_count: 0
favorite_count: 0
entities: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
hashtags: []
urls: []
user_mentions:
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
screen_name: ScruffyMcG
name: Ryan Lue
id: 2975699229
id_str: '2975699229'
indices:
- 0
- 11
symbols: []
favorited: false
retweeted: false
filter_level: low
lang: en
timestamp_ms: '1577113612532'
controller: channels_twitter
action: webhook_incoming