weibo_user_agent_spec.rb 770 B

12345678910111213141516171819202122232425262728
  1. # encoding: utf-8
  2. require 'rails_helper'
  3. describe Agents::WeiboUserAgent do
  4. before do
  5. # intercept the twitter API request for @tectonic's user profile
  6. stub_request(:any, /api.weibo.com/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/one_weibo.json")), :status => 200)
  7. @opts = {
  8. :uid => "123456",
  9. :expected_update_period_in_days => "2",
  10. :app_key => "asdfe",
  11. :app_secret => "asdfe",
  12. :access_token => "asdfe"
  13. }
  14. @checker = Agents::WeiboUserAgent.new(:name => "123456 fetcher", :options => @opts)
  15. @checker.user = users(:bob)
  16. @checker.save!
  17. end
  18. describe "#check" do
  19. it "should check for changes" do
  20. expect { @checker.check }.to change { Event.count }.by(1)
  21. end
  22. end
  23. end