← Back to Upcase

Twitter.search return strange results


(Nikhil Hira) #1

I’m at the integration test in the TDD course where I’m asserting that “rails” shows up in my Twitter search. This test fails. When I look at the results of Twitter.search(’##{params[:id]}’).results, where params[:id] is “rails” I get weird tweets back that don’t have rails anywhere in the text. In fact I get the same tweets no matter what I search for. Can someone help me figure this out?

Here are the tweets:

0002 【イメージタグにリンクをはる】<%= link_to image_tag(“.gif"), :action => “show”, :id => params[:id] %>
0002 【イメージタグにリンクをはる】<%= link_to image_tag("
.gif”), :action => “show”, :id => params[:id] %>
0002 【イメージタグにリンクをはる】<%= link_to image_tag(“.gif"), :action => “show”, :id => params[:id] %>
0002 【イメージタグにリンクをはる】<%= link_to image_tag("
.gif”), :action => “show”, :id => params[:id] %>
@FitchRatings Upgrades #Tatarstan to ‘BBB’; Outlook Stable http://t.co/c0a1D4iXOc via @CbondsRu #Russia
Fitch Revises #Kazan’s Outlook to Positive; Affirms at ‘B+’ http://t.co/c0a1D4iXOc #tatarstan
0002 【イメージタグにリンクをはる】<%= link_to image_tag(“.gif"), :action => “show”, :id => params[:id] %>
RT @Limburger: UPDATE Op onze website staan weer nieuwe foto’s van #Solar13 #Solar #Roermond
RT @Sittard_Geleen: UPDATE Op onze website staan weer nieuwe foto’s van #Solar13 #Solar #Roermond
UPDATE Op onze website staan weer nieuwe foto’s van #Solar13 #Solar #Roermond
0002 【イメージタグにリンクをはる】<%= link_to image_tag("
.gif”), :action => “show”, :id => params[:id] %>
RT @SusanneWeigelt: Gefällt euch auch der Toyota Auris Hybrid TV Spot am besten?
Gefällt euch auch der Toyota Auris Hybrid TV Spot am besten?
RT @Limburger: Op onze website staan de eerste foto’s van #Solar13 #Solar #Roermond
Я.Новости | Финансы: Приостановлены торги облигациями ММК серии БО-08


(Josh Clayton) #2

@nikhilhira are you interpolating the Ruby string? You’ll want to start with Twitter.search("##{params[:id]}").results instead of Twitter.search('##{params[:id]}').results (notice double vs. single quotes) to ensure the string the user is searching for gets passed through correctly. Let me know if you still run into issues!


(Nikhil Hira) #3

@joshclayton thanks. That was a silly mistake on my part. It works now:)