2016-04-01 05:33:25 +08:00
|
|
|
require 'rails_helper'
|
2014-01-01 03:37:43 +08:00
|
|
|
require_dependency 'jobs/regular/process_post'
|
|
|
|
|
|
|
|
describe Jobs::PollFeed do
|
|
|
|
let(:poller) { Jobs::PollFeed.new }
|
|
|
|
|
|
|
|
context "execute" do
|
|
|
|
let(:url) { "http://eviltrout.com" }
|
|
|
|
let(:embed_by_username) { "eviltrout" }
|
|
|
|
|
|
|
|
it "requires feed_polling_enabled?" do
|
2015-06-03 18:14:00 +08:00
|
|
|
SiteSetting.feed_polling_enabled = true
|
|
|
|
SiteSetting.feed_polling_url = nil
|
2014-04-25 00:48:45 +08:00
|
|
|
poller.expects(:poll_feed).never
|
|
|
|
poller.execute({})
|
2014-01-01 03:37:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "requires feed_polling_url" do
|
2015-06-03 18:14:00 +08:00
|
|
|
SiteSetting.feed_polling_enabled = false
|
|
|
|
SiteSetting.feed_polling_url = nil
|
2014-04-25 00:48:45 +08:00
|
|
|
poller.expects(:poll_feed).never
|
|
|
|
poller.execute({})
|
2014-01-01 03:37:43 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
it "delegates to poll_feed" do
|
2015-06-03 18:14:00 +08:00
|
|
|
SiteSetting.feed_polling_enabled = true
|
|
|
|
SiteSetting.feed_polling_url = url
|
2014-01-01 03:37:43 +08:00
|
|
|
poller.expects(:poll_feed).once
|
|
|
|
poller.execute({})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|