Commit 96adc9767f77bcae22fe8bfa0cbd00ed3aa95aae
1 parent
dab47d32
Exists in
master
and in
29 other branches
Fix RSS link tag and tests
(ActionItem1518)
Showing
4 changed files
with
6 additions
and
15 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -871,7 +871,7 @@ module ApplicationHelper | @@ -871,7 +871,7 @@ module ApplicationHelper | ||
871 | 871 | ||
872 | def add_rss_feed_to_head(title, url) | 872 | def add_rss_feed_to_head(title, url) |
873 | content_for :feeds do | 873 | content_for :feeds do |
874 | - "<link rel='alternate' type='application/rss+xml' title='#{h(title)}' href='#{url_for(url)}' />" | 874 | + tag(:link, :rel => 'alternate', :type => 'application/rss+xml', :title => title, :href => url_for(url)) |
875 | end | 875 | end |
876 | end | 876 | end |
877 | 877 |
test/functional/cms_controller_test.rb
@@ -178,20 +178,19 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -178,20 +178,19 @@ class CmsControllerTest < Test::Unit::TestCase | ||
178 | should 'be able to create a RSS feed' do | 178 | should 'be able to create a RSS feed' do |
179 | login_as(profile.identifier) | 179 | login_as(profile.identifier) |
180 | assert_difference RssFeed, :count do | 180 | assert_difference RssFeed, :count do |
181 | - post :new, :type => RssFeed.name, :profile => profile.identifier, :article => { :name => 'new-feed', :limit => 15, :include => 'all', :feed_item_description => 'body' } | 181 | + post :new, :type => RssFeed.name, :profile => profile.identifier, :article => { :name => 'new-feed', :limit => 15, :include => 'all' } |
182 | assert_response :redirect | 182 | assert_response :redirect |
183 | end | 183 | end |
184 | end | 184 | end |
185 | 185 | ||
186 | should 'be able to update a RSS feed' do | 186 | should 'be able to update a RSS feed' do |
187 | login_as(profile.identifier) | 187 | login_as(profile.identifier) |
188 | - feed = RssFeed.create!(:name => 'myfeed', :limit => 5, :feed_item_description => 'body', :include => 'all', :profile_id => profile.id) | ||
189 | - post :edit, :profile => profile.identifier, :id => feed.id, :article => { :limit => 77, :feed_item_description => 'abstract', :include => 'parent_and_children' } | 188 | + feed = RssFeed.create!(:name => 'myfeed', :limit => 5, :include => 'all', :profile_id => profile.id) |
189 | + post :edit, :profile => profile.identifier, :id => feed.id, :article => { :limit => 77, :include => 'parent_and_children' } | ||
190 | assert_response :redirect | 190 | assert_response :redirect |
191 | 191 | ||
192 | updated = RssFeed.find(feed.id) | 192 | updated = RssFeed.find(feed.id) |
193 | assert_equal 77, updated.limit | 193 | assert_equal 77, updated.limit |
194 | - assert_equal 'abstract', updated.feed_item_description | ||
195 | assert_equal 'parent_and_children', updated.include | 194 | assert_equal 'parent_and_children', updated.include |
196 | end | 195 | end |
197 | 196 |
test/functional/content_viewer_controller_test.rb
@@ -672,7 +672,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -672,7 +672,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
672 | login_as(profile.identifier) | 672 | login_as(profile.identifier) |
673 | profile.articles << Blog.new(:name => 'Blog', :profile => profile) | 673 | profile.articles << Blog.new(:name => 'Blog', :profile => profile) |
674 | get :view_page, :profile => profile.identifier, :page => ['blog'] | 674 | get :view_page, :profile => profile.identifier, :page => ['blog'] |
675 | - assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } | 675 | + assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Blog', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
676 | end | 676 | end |
677 | 677 | ||
678 | should 'add meta tag to rss feed on view post blog' do | 678 | should 'add meta tag to rss feed on view post blog' do |
@@ -680,7 +680,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -680,7 +680,7 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
680 | profile.articles << Blog.new(:name => 'Blog', :profile => profile) | 680 | profile.articles << Blog.new(:name => 'Blog', :profile => profile) |
681 | profile.blog.posts << TextileArticle.new(:name => 'first post', :parent => profile.blog, :profile => profile) | 681 | profile.blog.posts << TextileArticle.new(:name => 'first post', :parent => profile.blog, :profile => profile) |
682 | get :view_page, :profile => profile.identifier, :page => ['blog', 'first-post'] | 682 | get :view_page, :profile => profile.identifier, :page => ['blog', 'first-post'] |
683 | - assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'feed', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } | 683 | + assert_tag :tag => 'link', :attributes => { :rel => 'alternate', :type => 'application/rss+xml', :title => 'Blog', :href => "http://#{environment.default_hostname}/testinguser/blog/feed" } |
684 | end | 684 | end |
685 | 685 | ||
686 | should 'hit the article when viewed' do | 686 | should 'hit the article when viewed' do |
test/unit/application_helper_test.rb
@@ -237,14 +237,6 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -237,14 +237,6 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
237 | assert_nil select_categories(mock) | 237 | assert_nil select_categories(mock) |
238 | end | 238 | end |
239 | 239 | ||
240 | - should 'create rss feed link to blog' do | ||
241 | - @controller = mock | ||
242 | - @controller.stubs(:controller_name).returns('content_viewer') | ||
243 | - p = create_user('testuser').person | ||
244 | - b = Blog.create!(:profile => p, :name => 'blog_feed_test') | ||
245 | - assert_tag_in_string meta_tags_for_article(b), :tag => 'link', :attributes => {:type => 'application/rss+xml', :title => 'feed'} | ||
246 | - end | ||
247 | - | ||
248 | should 'provide sex icon for males' do | 240 | should 'provide sex icon for males' do |
249 | stubs(:environment).returns(Environment.default) | 241 | stubs(:environment).returns(Environment.default) |
250 | expects(:content_tag).with(anything, 'male').returns('MALE!!') | 242 | expects(:content_tag).with(anything, 'male').returns('MALE!!') |