Sha256: 198d4ca886da7d31039d1f5932db1f8ab3bd1385d10b3af1860e58282f3d3473

Contents?: true

Size: 1023 Bytes

Versions: 5

Compression:

Stored size: 1023 Bytes

Contents

$:.unshift(File.dirname(__FILE__))
require 'spec_helper'

describe Twhere do
  before :each do
    # mock Twitter proxy object
    user_timeline = []
    user_timeline << Mash.new({:twitter_id=>1, :text=>'one #home', :created_at=>'Wed Apr 29 12:00:00 +0000 2009'})
    user_timeline << Mash.new({:twitter_id=>2, :text=>'two #work', :created_at=>'Wed Apr 29 13:00:00 +0000 2009'})
    mock_twitter = mock('twitter')
    mock_twitter.should_receive(:user_timeline).and_return(user_timeline)
    Twitter::Base.should_receive(:new).and_return(mock_twitter)

    # create Twhere instance
    locations = {'home'=>'59.35,18.066667', 'work'=>'59.35,18.066667'}
    template = %Q{<% for location in @located_tweets.keys.sort %><%= location %>: <%= @located_tweets[location].map {|t| t[:text]}.join %>\n<% end %>}
    @twhere = Twhere.new(locations, template, nil, nil, nil)
  end

  it 'should produce a result' do
    expected_result = %Q{home: one #home\nwork: two #work\n}
    @twhere.result.should == expected_result
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sarnesjo-twhere-0.0.10 spec/twhere_spec.rb
sarnesjo-twhere-0.0.11 spec/twhere_spec.rb
sarnesjo-twhere-0.0.12 spec/twhere_spec.rb
sarnesjo-twhere-0.0.8 spec/twhere_spec.rb
sarnesjo-twhere-0.0.9 spec/twhere_spec.rb