Commit bcd1f5f771dd6ddd5a22d0d22d7a9626daffee35
1 parent
8553413d
Exists in
master
and in
29 other branches
ActionItem23: "finishing" RSS feeds
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1132 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
4 changed files
with
30 additions
and
3 deletions
Show diff stats
app/models/rss_feed.rb
@@ -0,0 +1,7 @@ | @@ -0,0 +1,7 @@ | ||
1 | +<%= f.text_field :name %> | ||
2 | + | ||
3 | +<%= labelled_form_field(_('Limit of articles'), f.text_field(:limit)) %> | ||
4 | + | ||
5 | +<%= labelled_form_field(_('Use as item description:'), f.select(:feed_item_description, [ [ _('Article body'), 'body'], [ _('Article abstract'), 'abstract']])) %> | ||
6 | + | ||
7 | +<%= labelled_form_field(_('Include:'), f.select(:include, [ [ _('All articles'), 'all' ], [ _('Only articles child of the same article as the feed'), 'parent_and_children']] )) %> |
test/functional/cms_controller_test.rb
@@ -142,4 +142,24 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -142,4 +142,24 @@ class CmsControllerTest < Test::Unit::TestCase | ||
142 | end | 142 | end |
143 | end | 143 | end |
144 | 144 | ||
145 | + should 'be able to create a RSS feed' do | ||
146 | + login_as('ze') | ||
147 | + assert_difference RssFeed, :count do | ||
148 | + post :new, :type => RssFeed.name, :profile => profile.identifier, :article => { :name => 'feed', :limit => 15, :include => 'all', :feed_item_description => 'body' } | ||
149 | + assert_response :redirect | ||
150 | + end | ||
151 | + end | ||
152 | + | ||
153 | + should 'be able to update a RSS feed' do | ||
154 | + login_as('ze') | ||
155 | + feed = RssFeed.create!(:name => 'myfeed', :limit => 5, :feed_item_description => 'body', :include => 'all', :profile_id => profile.id) | ||
156 | + post :edit, :profile => profile.identifier, :id => feed.id, :article => { :limit => 77, :feed_item_description => 'abstract', :include => 'parent_and_children' } | ||
157 | + assert_response :redirect | ||
158 | + | ||
159 | + updated = RssFeed.find(feed.id) | ||
160 | + assert_equal 77, updated.limit | ||
161 | + assert_equal 'abstract', updated.feed_item_description | ||
162 | + assert_equal 'parent_and_children', updated.include | ||
163 | + end | ||
164 | + | ||
145 | end | 165 | end |
test/unit/rss_feed_test.rb
@@ -165,12 +165,12 @@ class RssFeedTest < Test::Unit::TestCase | @@ -165,12 +165,12 @@ class RssFeedTest < Test::Unit::TestCase | ||
165 | end | 165 | end |
166 | 166 | ||
167 | should 'provide proper short description' do | 167 | should 'provide proper short description' do |
168 | - RssFeed.expects(:==).with(Article).returns(true).at_least_once | 168 | + RssFeed.stubs(:==).with(Article).returns(true) |
169 | assert_not_equal Article.short_description, RssFeed.short_description | 169 | assert_not_equal Article.short_description, RssFeed.short_description |
170 | end | 170 | end |
171 | 171 | ||
172 | should 'provide proper description' do | 172 | should 'provide proper description' do |
173 | - RssFeed.expects(:==).with(Article).returns(true).at_least_once | 173 | + RssFeed.stubs(:==).with(Article).returns(true) |
174 | assert_not_equal Article.description, RssFeed.description | 174 | assert_not_equal Article.description, RssFeed.description |
175 | end | 175 | end |
176 | 176 |