nisanth074
1/3/2015 - 10:54 AM

gistfile1.rb

describe RepoSynchronizationJob do
  it 'sets refreshing_repos to true before synchronization' do
    is_refreshing_repos_set_to_true = Proc.new do |user_id|
      User.find(user_id).refreshing_repos == true
    end

    user = create(:user, refreshing_repos: false)
    github_token = 'token'
    expect(user.refreshing_repos).to be_false
    flexmock(RepoSynchronization).should_receive(:call).with(FlexMock.on(&is_refreshing_repos_set_to_true), Flexmock.any).once
    RepoSynchronizationJob.new(user_id, github_token).perform_now
  end
end