Slightly fix the regexps

The quantifier `+?` does not make sense here, so I guess you actually
meant this.
This commit is contained in:
Akinori MUSHA 2017-01-19 17:38:27 +09:00
parent af5c5b5f62
commit 7d1c87ddbd
3 changed files with 9 additions and 3 deletions

View file

@ -2,7 +2,9 @@ require 'rails_helper'
describe Agents::TwitterFavorites do
before do
stub_request(:any, /tectonic.+?tweet_mode=extended/).to_return(body: File.read(Rails.root.join("spec/data_fixtures/user_fav_tweets.json")), status: 200)
stub_request(:any, /tectonic.*[?&]tweet_mode=extended/).
to_return(body: File.read(Rails.root.join("spec/data_fixtures/user_fav_tweets.json")),
status: 200)
end
before do

View file

@ -3,7 +3,9 @@ require 'rails_helper'
describe Agents::TwitterSearchAgent do
before do
# intercept the twitter API request
stub_request(:any, /freebandnames.+?tweet_mode=extended/).to_return(body: File.read(Rails.root.join("spec/data_fixtures/search_tweets.json")), status: 200)
stub_request(:any, /freebandnames.*[?&]tweet_mode=extended/).
to_return(body: File.read(Rails.root.join("spec/data_fixtures/search_tweets.json")),
status: 200)
@opts = {
search: "freebandnames",
expected_update_period_in_days: "2",

View file

@ -3,7 +3,9 @@ require 'rails_helper'
describe Agents::TwitterUserAgent do
before do
# intercept the twitter API request for @tectonic's user profile
stub_request(:any, "https://api.twitter.com/1.1/statuses/user_timeline.json?contributor_details=true&count=200&exclude_replies=false&include_entities=true&include_rts=true&screen_name=tectonic&tweet_mode=extended").to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
stub_request(:any, "https://api.twitter.com/1.1/statuses/user_timeline.json?contributor_details=true&count=200&exclude_replies=false&include_entities=true&include_rts=true&screen_name=tectonic&tweet_mode=extended").
to_return(body: File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")),
status: 200)
@opts = {
:username => "tectonic",