blob: 0022411906503c931a082a099ac2722ba9775b6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
require 'test_helper'
class RssControllerTest < ActionController::TestCase
def setup
@user = User.create :login => 'rsstest', :email => 'rsstest@example.com',
:password => 'foobar', :password_confirmation => 'foobar'
updates = Node.root.children.find_by(:slug => "updates") ||
Node.root.children.create!(:slug => "updates")
@node = updates.children.create! :slug => 'rss_test_node'
draft = find_or_create_draft(@node, @user)
draft.title = "RSS Update Article"
draft.tag_list = "update"
draft.save
@node.publish_draft!
end
test "updates feed contains tagged pages" do
get :updates, params: { format: :xml }
assert assigns(:items).any?, "Expected at least one page tagged with 'update'"
end
test "updates feed is limited to 20 items" do
get :updates, params: { format: :xml }
assert assigns(:items).length <= 20
end
test "the update feed excludes a page tagged update outside /updates" do
updates = Node.root.children.find_by(:slug => "updates")
inside = updates.children.create!(:slug => "feed-inside")
outside = Node.root.children.create!(:slug => "feed-outside")
[inside, outside].each do |node|
node.reload.draft.update!(:title => node.slug, :tag_list => "update")
node.publish_draft!
end
get :updates, params: { :format => :xml }
assert_response :success
assert_includes @response.body, "feed-inside"
assert_not_includes @response.body, "feed-outside"
end
end
|