diff --git a/app/services/twitter_service.rb b/app/services/twitter_service.rb index abf0e92..aa7237e 100644 --- a/app/services/twitter_service.rb +++ b/app/services/twitter_service.rb @@ -17,7 +17,7 @@ def download_tweets opts[:since_id] = tweet.id end - tl = client.user_timeline('InfractoresBA', opts) + tl = client.mentions_timeline(opts) tl.each do |tuit| Tweet.find_or_create!(tuit) diff --git a/spec/services/twitter_service_spec.rb b/spec/services/twitter_service_spec.rb index 5a94286..0a2c706 100644 --- a/spec/services/twitter_service_spec.rb +++ b/spec/services/twitter_service_spec.rb @@ -27,7 +27,7 @@ context "search and mentions return only one tweet" do before do allow(twitter_service.client) - .to(receive(:user_timeline) + .to(receive(:mentions_timeline) .and_return([tweet])) allow(twitter_service.client) .to(receive(:search) @@ -52,7 +52,9 @@ it 'create tweet' do expect do - twitter_service.download_tweets + VCR.use_cassette("user-tweets") do + twitter_service.download_tweets + end end.to change(Tweet, :count).by(1) end end @@ -62,7 +64,9 @@ it 'create tweet' do expect do - twitter_service.download_tweets + VCR.use_cassette("user-tweets") do + twitter_service.download_tweets + end end.to change(Tweet, :count).by(1) end end @@ -74,7 +78,7 @@ VCR.use_cassette("user-tweets") do twitter_service.download_tweets end - end.to change(Tweet, :count).by(9) + end.to change(Tweet, :count).by(22) end end end