twitter_user_agent_spec.rb 794B

12345678910111213141516171819202122232425262728
  1. require 'spec_helper'
  2. describe Agents::TwitterUserAgent do
  3. before do
  4. # intercept the twitter API request for @tectonic's user profile
  5. stub_request(:any, /tectonic/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/user_tweets.json")), :status => 200)
  6. @opts = {
  7. :username => "tectonic",
  8. :expected_update_period_in_days => "2",
  9. :consumer_key => "---",
  10. :consumer_secret => "---",
  11. :oauth_token => "---",
  12. :oauth_token_secret => "---"
  13. }
  14. @checker = Agents::TwitterUserAgent.new(:name => "tectonic", :options => @opts)
  15. @checker.user = users(:bob)
  16. @checker.save!
  17. end
  18. describe "#check" do
  19. it "should check for changes" do
  20. lambda { @checker.check }.should change { Event.count }.by(5)
  21. end
  22. end
  23. end