Created
February 20, 2014 23:39
-
-
Save richardking/9125719 to your computer and use it in GitHub Desktop.
insta2 - model spec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe InstagramSyncFollowingWorker do | |
| it 'should import or sync based on number of followers' do | |
| InstagramAccount.stub(:import_or_sync) | |
| VCR.use_cassette 'lib/instagram_user_follows' do | |
| response = Instagram.user_follows | |
| InstagramAccount.should_receive(:import_or_sync).exactly(response.count).times | |
| InstagramSyncFollowingWorker.perform | |
| end | |
| end | |
| it 'should update import_enabled for accounts that are not being followed anymore' do | |
| VCR.use_cassette 'lib/instagram_user_follows_2' do | |
| account = FactoryGirl.build(:instagram_account) | |
| account.stub(:sync_following) | |
| account.stub(:get_instagram_id) | |
| account.save | |
| InstagramSyncFollowingWorker.perform | |
| InstagramAccount.find(:all, :conditions => ["import_enabled = ?", true]).count.should == 2 | |
| InstagramAccount.find(:all, :conditions => ["import_enabled = ?", false]).count.should == 1 | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment