ぼざクリタグ広場 https://hub.nizika.monster
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

26 lines
577 B

  1. require 'rails_helper'
  2. require 'rake'
  3. RSpec.describe 'post:sync' do
  4. around do |example|
  5. original_application = Rake.application
  6. Rake.application = Rake::Application.new
  7. Rake::Task.define_task(:environment)
  8. load Rails.root.join('lib/tasks/sync_posts.rake')
  9. example.run
  10. ensure
  11. Rake.application = original_application
  12. end
  13. it 'runs Youtube::Sync' do
  14. sync = instance_double(Youtube::Sync)
  15. expect(Youtube::Sync).to receive(:new).once.and_return(sync)
  16. expect(sync).to receive(:sync!).once
  17. Rake::Task['post:sync'].invoke
  18. end
  19. end