diff options
Diffstat (limited to 'test/controllers/rss_controller_test.rb')
| -rw-r--r-- | test/controllers/rss_controller_test.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/test/controllers/rss_controller_test.rb b/test/controllers/rss_controller_test.rb index 3f4b4fbf..cf50903a 100644 --- a/test/controllers/rss_controller_test.rb +++ b/test/controllers/rss_controller_test.rb | |||
| @@ -5,7 +5,9 @@ class RssControllerTest < ActionController::TestCase | |||
| 5 | def setup | 5 | def setup |
| 6 | @user = User.create :login => 'rsstest', :email => 'rsstest@example.com', | 6 | @user = User.create :login => 'rsstest', :email => 'rsstest@example.com', |
| 7 | :password => 'foobar', :password_confirmation => 'foobar' | 7 | :password => 'foobar', :password_confirmation => 'foobar' |
| 8 | @node = Node.root.children.create! :slug => 'rss_test_node' | 8 | updates = Node.root.children.find_by(:slug => "updates") || |
| 9 | Node.root.children.create!(:slug => "updates") | ||
| 10 | @node = updates.children.create! :slug => 'rss_test_node' | ||
| 9 | draft = find_or_create_draft(@node, @user) | 11 | draft = find_or_create_draft(@node, @user) |
| 10 | draft.title = "RSS Update Article" | 12 | draft.title = "RSS Update Article" |
| 11 | draft.tag_list = "update" | 13 | draft.tag_list = "update" |
| @@ -31,4 +33,20 @@ class RssControllerTest < ActionController::TestCase | |||
| 31 | assert assigns(:items).length <= 20 | 33 | assert assigns(:items).length <= 20 |
| 32 | end | 34 | end |
| 33 | 35 | ||
| 36 | test "the update feed excludes a page tagged update outside /updates" do | ||
| 37 | updates = Node.root.children.find_by(:slug => "updates") | ||
| 38 | inside = updates.children.create!(:slug => "feed-inside") | ||
| 39 | outside = Node.root.children.create!(:slug => "feed-outside") | ||
| 40 | |||
| 41 | [inside, outside].each do |node| | ||
| 42 | node.reload.draft.update!(:title => node.slug, :tag_list => "update") | ||
| 43 | node.publish_draft! | ||
| 44 | end | ||
| 45 | |||
| 46 | get :updates, params: { :format => :xml } | ||
| 47 | |||
| 48 | assert_response :success | ||
| 49 | assert_includes @response.body, "feed-inside" | ||
| 50 | assert_not_includes @response.body, "feed-outside" | ||
| 51 | end | ||
| 34 | end | 52 | end |
