mirror of
https://github.com/discourse/discourse.git
synced 2024-12-01 08:33:44 +08:00
47 lines
1.1 KiB
Ruby
47 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
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" }
|
|
|
|
before do
|
|
$redis.del("feed-polled-recently")
|
|
end
|
|
|
|
it "requires feed_polling_enabled?" do
|
|
SiteSetting.feed_polling_enabled = true
|
|
SiteSetting.feed_polling_url = nil
|
|
poller.expects(:poll_feed).never
|
|
poller.execute({})
|
|
end
|
|
|
|
it "requires feed_polling_url" do
|
|
SiteSetting.feed_polling_enabled = false
|
|
SiteSetting.feed_polling_url = nil
|
|
poller.expects(:poll_feed).never
|
|
poller.execute({})
|
|
end
|
|
|
|
it "delegates to poll_feed" do
|
|
SiteSetting.feed_polling_enabled = true
|
|
SiteSetting.feed_polling_url = url
|
|
poller.expects(:poll_feed).once
|
|
poller.execute({})
|
|
end
|
|
|
|
it "won't poll if it has polled recently" do
|
|
SiteSetting.feed_polling_enabled = true
|
|
SiteSetting.feed_polling_url = url
|
|
poller.expects(:poll_feed).once
|
|
poller.execute({})
|
|
poller.execute({})
|
|
end
|
|
|
|
end
|
|
|
|
end
|