64c882b090
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.
76 lines
2.3 KiB
YAML
76 lines
2.3 KiB
YAML
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
|
for_user_id: '2975699229'
|
|
tweet_create_events:
|
|
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
|
|
created_at: Thu Dec 19 10:37:42 +0000 2019
|
|
id: 1207610954160037890
|
|
id_str: '1207610954160037890'
|
|
text: Bleep bloop.
|
|
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: 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: 7
|
|
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: []
|
|
symbols: []
|
|
favorited: false
|
|
retweeted: false
|
|
filter_level: low
|
|
lang: en
|
|
timestamp_ms: '1576751862455'
|
|
controller: channels_twitter
|
|
action: webhook_incoming
|