← Back to Upcase

Unable to match text from twitter search


(Damien Hogan) #1

`Hello,

I am doing the twitter app Week 3. I have started using the twitter gem and made amendments to allow it to work from what was stated on the video, however I get the following error when trying to match the hashtag.

1) search twitter for a term searching by a hashtag
 Failure/Error: expect(tweet.text).to match /#rails/i
   expected "RT @starterleague: Make your ideas real on the web at @starterleague - Apply for Summer Web Development now http://t.co/IZp7CRvchj #ruby #r…" to match /#rails/i
   Diff:
   @@ -1,2 +1,2 @@
   -/#rails/i
   +"RT @starterleague: Make your ideas real on the web at @starterleague - Apply for Summer Web Development now http://t.co/IZp7CRvchj #ruby #r…"
   
 # ./spec/integration/search_twitter_spec.rb:9:in `block (3 levels) in <top (required)>'
 # ./spec/integration/search_twitter_spec.rb:8:in `each'
 # ./spec/integration/search_twitter_spec.rb:8:in `block (2 levels) in <top (required)>'

Finished in 1.91 seconds
1 example, 1 failure

Here is my spec

 require 'spec_helper'

 feature 'search twitter for a term' do
scenario 'searching by a hashtag' do
visit root_path
fill_in 'Search', with: 'Rails'
click_button 'Search'
all('li.tweet').each do |tweet|
  expect(tweet.text).to match /#rails/i
end
end
end

and my show file

<ul>
<% @tweets.each do |tweet| %>
<li class='tweet'><%= tweet.text %></li>
<% end %>

I cant see why it looks to be finding rails but not match it. Any help would be very much appreciated.


(Damien Hogan) #2

so weird but its passed today with no changes. It must be something thats getting picked up by searches at some point.