Commit 7020cd0e9a0000e4e3aa83e2674ae3cbe66f489b
Exists in
master
and in
29 other branches
Merge branch 'stable'
Conflicts: debian/changelog lib/noosfero.rb
Showing
26 changed files
with
196 additions
and
79 deletions
Show diff stats
app/helpers/content_viewer_helper.rb
... | ... | @@ -20,14 +20,18 @@ module ContentViewerHelper |
20 | 20 | unless args[:no_link] |
21 | 21 | title = content_tag('h1', link_to(article.name, article.url), :class => 'title') |
22 | 22 | end |
23 | - comments = args[:no_comments] ? '' : (("- %s") % link_to_comments(article)) | |
23 | + comments = '' | |
24 | + unless args[:no_comments] || !article.accept_comments | |
25 | + comments = ("- %s") % link_to_comments(article) | |
26 | + end | |
24 | 27 | title << content_tag('span', _("%s, by %s %s") % [show_date(article.published_at), link_to(article.author_name, article.author.url), comments], :class => 'created-at') |
25 | 28 | end |
26 | 29 | title |
27 | 30 | end |
28 | 31 | |
29 | 32 | def link_to_comments(article, args = {}) |
30 | - link_to( number_of_comments(article), article.url.merge(:anchor => 'comments_list') ) | |
33 | + return '' unless article.accept_comments? | |
34 | + link_to(number_of_comments(article), article.url.merge(:anchor => 'comments_list') ) | |
31 | 35 | end |
32 | 36 | |
33 | 37 | def article_translations(article) | ... | ... |
app/helpers/search_helper.rb
... | ... | @@ -65,7 +65,7 @@ module SearchHelper |
65 | 65 | data << content_tag('strong', _('Address: ')) + profile.address + '<br/>' |
66 | 66 | end |
67 | 67 | unless profile.products.empty? |
68 | - data << content_tag('strong', _('Products/Services: ')) + profile.products.map{|i| link_to(i.name, :controller => 'catalog', :profile => profile.identifier, :action => 'show', :id => i.id)}.join(', ') + '<br/>' | |
68 | + data << content_tag('strong', _('Products/Services: ')) + profile.products.map{|i| link_to(i.name, :controller => 'manage_products', :profile => profile.identifier, :action => 'show', :id => i.id)}.join(', ') + '<br/>' | |
69 | 69 | end |
70 | 70 | if profile.respond_to?(:distance) and !profile.distance.nil? |
71 | 71 | data << content_tag('strong', _('Distance: ')) + "%.2f%" % profile.distance + '<br/>' | ... | ... |
app/models/uploaded_file.rb
... | ... | @@ -30,6 +30,10 @@ class UploadedFile < Article |
30 | 30 | title.blank? ? name : title |
31 | 31 | end |
32 | 32 | |
33 | + def first_paragraph | |
34 | + '' | |
35 | + end | |
36 | + | |
33 | 37 | def self.max_size |
34 | 38 | UploadedFile.attachment_options[:max_size] |
35 | 39 | end |
... | ... | @@ -50,7 +54,7 @@ class UploadedFile < Article |
50 | 54 | |
51 | 55 | def self.icon_name(article = nil) |
52 | 56 | if article |
53 | - article.image? ? article.public_filename(:icon) : article.mime_type.gsub(/[\/+.]/, '-') | |
57 | + article.image? ? article.public_filename(:icon) : (article.mime_type ? article.mime_type.gsub(/[\/+.]/, '-') : 'upload-file') | |
54 | 58 | else |
55 | 59 | 'upload-file' |
56 | 60 | end | ... | ... |
app/views/cms/_event.rhtml
... | ... | @@ -15,5 +15,4 @@ |
15 | 15 | |
16 | 16 | <%= labelled_form_field(_('Address:'), text_field(:article, :address)) %> |
17 | 17 | |
18 | -<%= labelled_form_field(_('Information about the event:'), text_area(:article, :body, :cols => 64, :class => 'mceEditor')) %> | |
19 | - | |
18 | +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :body_label => 'Information about the event:'} %> | ... | ... |
app/views/cms/_textile_article.rhtml
... | ... | @@ -5,17 +5,4 @@ |
5 | 5 | <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64')) %> |
6 | 6 | |
7 | 7 | <%= render :partial => 'translatable' %> |
8 | - | |
9 | -<br style="clear: both;"/> | |
10 | -<%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | |
11 | -<em><%= _('Used when a short version of your text is needed.') %></em> | |
12 | - | |
13 | -<div id="article-lead"> | |
14 | - <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :cols => 64, :rows => 10)) %> | |
15 | -</div> | |
16 | -<div style="margin-top: 10px;"> | |
17 | - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :cols => 64, :rows => 30)) %> | |
18 | -</div> | |
19 | - | |
20 | -<%= javascript_include_tag 'article'%> | |
21 | - | |
8 | +<%= render :partial => 'shared/lead_and_body' %> | ... | ... |
app/views/cms/_tiny_mce_article.rhtml
... | ... | @@ -12,18 +12,5 @@ |
12 | 12 | <% end %> |
13 | 13 | |
14 | 14 | <%= render :partial => 'translatable' %> |
15 | - | |
16 | - <br style="clear: both;"/> | |
17 | - <%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | |
18 | - <em><%= _('Used when a short version of your text is needed.') %></em> | |
19 | - | |
20 | - <div id="article-lead"> | |
21 | - <%= labelled_form_field(_('Lead'), text_area(:article, 'abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %> | |
22 | - </div> | |
23 | - <div style="margin-top: 10px;"> | |
24 | - <%= labelled_form_field(_('Text'), text_area(:article, 'body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %> | |
25 | - </div> | |
26 | - | |
15 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true} %> | |
27 | 16 | </div> |
28 | - | |
29 | -<%= javascript_include_tag 'article' %> | ... | ... |
app/views/cms/suggest_an_article.rhtml
... | ... | @@ -16,16 +16,7 @@ |
16 | 16 | |
17 | 17 | <%= required labelled_form_field(_('Email'), text_field(:task, 'email')) %> |
18 | 18 | |
19 | - <br style="clear: both;"/> | |
20 | - <%= button :add, _("Lead"), '#', :id => "lead-button", :style => "margin-left: 0px;" %> | |
21 | - <em><%= _('Used when a short version of your text is needed.') %></em> | |
22 | - | |
23 | - <div id="article-lead"> | |
24 | - <%= labelled_form_field(_('Lead'), text_area(:task , 'article_abstract', :style => 'width: 100%; height: 200px;', :class => 'mceEditor')) %> | |
25 | - </div> | |
26 | - <div style="margin-top: 10px;"> | |
27 | - <%= labelled_form_field(_('Text'), text_area(:task, 'article_body', :style => 'width:100%; height: 500px;', :class => 'mceEditor')) %> | |
28 | - </div> | |
19 | + <%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :object => :task, :abstract_method => 'article_abstract', :body_method => 'article_body'} %> | |
29 | 20 | |
30 | 21 | <div id="captcha"> |
31 | 22 | <%= labelled_form_field(_("What is the result of '%s = ?'") % @task.captcha.task, text_field(:task, 'captcha_solution')) %> |
... | ... | @@ -39,5 +30,3 @@ |
39 | 30 | <%= button :cancel, _('Cancel'), @back_to %> |
40 | 31 | <% end %> |
41 | 32 | <% end %> |
42 | - | |
43 | -<%= javascript_include_tag 'article' %> | ... | ... |
... | ... | @@ -0,0 +1,29 @@ |
1 | +<% object ||= :article %> | |
2 | +<% abstract_label ||= 'Lead' %> | |
3 | +<% abstract_method ||= :abstract %> | |
4 | +<% body_label ||= 'Text' %> | |
5 | +<% body_method ||= :body %> | |
6 | +<% editor_type = defined?(tiny_mce) && tiny_mce ? 'mceEditor' : '' %> | |
7 | +<% lead_id ||= 0%> | |
8 | +<% f ||= false%> | |
9 | + | |
10 | +<br style="clear: both;"/> | |
11 | +<%= button :add, _("Lead"), '#', :class => "lead-button", :article_id => "#article-lead-"+lead_id.to_s, :style => "margin-left: 0px;" %> | |
12 | +<em><%= _('Used when a short version of your text is needed.') %></em> | |
13 | + | |
14 | +<div class='article-lead' id="article-lead-<%=lead_id.to_s%>"> | |
15 | + <% if f %> | |
16 | + <%= labelled_form_field(_(abstract_label), f.text_area(abstract_method, :style => 'width: 98%; height: 200px;', :class => editor_type)) %> | |
17 | + <% else %> | |
18 | + <%= labelled_form_field(_(abstract_label), text_area(object, abstract_method, :style => 'width: 98%; height: 200px;', :class => editor_type)) %> | |
19 | + <% end %> | |
20 | +</div> | |
21 | +<div style="margin-top: 10px;"> | |
22 | + <% if f %> | |
23 | + <%= labelled_form_field(_(body_label), f.text_area(body_method, :style => 'width: 98%; height: 400px;', :class => editor_type)) %> | |
24 | + <% else %> | |
25 | + <%= labelled_form_field(_(body_label), text_area(object, body_method, :style => 'width: 98%; height: 400px;', :class => editor_type)) %> | |
26 | + <% end %> | |
27 | +</div> | |
28 | + | |
29 | +<%= javascript_include_tag 'article'%> | ... | ... |
app/views/tasks/_approve_article_accept_details.rhtml
... | ... | @@ -4,21 +4,8 @@ |
4 | 4 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> |
5 | 5 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
6 | 6 | |
7 | -<div> | |
8 | - <% if task.article && task.article.tiny_mce? %> | |
9 | - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %> | |
10 | - <% else %> | |
11 | - <%= labelled_form_field(_('Lead'), f.text_area(:abstract, :style => 'width: 482px; height: 200px;')) %> | |
12 | - <% end %> | |
13 | -</div> | |
14 | -<em><%= _('Used when a short version your text is needed.') %></em> | |
7 | +<% tiny = task.article && task.article.tiny_mce? ? {:tiny_mce => true} : {} %> | |
8 | +<%= render :partial => 'shared/lead_and_body', :locals => {:lead_id => task.id, :f => f}.merge(tiny)%> | |
15 | 9 | |
16 | -<div style="margin-top: 10px;"> | |
17 | - <% if task.article && task.article.tiny_mce? %> | |
18 | - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %> | |
19 | - <% else %> | |
20 | - <%= labelled_form_field(_('Text'), f.text_area(:body, :style => 'width:482px; height: 500px;')) %> | |
21 | - <% end %> | |
22 | -</div> | |
23 | 10 | <%= labelled_form_field _('Comment for author'), f.text_field(:closing_statment, :style => 'width: 488px;') %> |
24 | 11 | ... | ... |
app/views/tasks/_suggest_article_accept_details.rhtml
... | ... | @@ -9,11 +9,4 @@ |
9 | 9 | <%= select_profile_folder(_('Select the folder where the article must be published'), "tasks[#{task.id}][task]", 'article_parent_id', task.target) %> |
10 | 10 | <%= labelled_form_field(_('Highlight this article'), f.check_box(:highlighted)) %> |
11 | 11 | |
12 | -<div> | |
13 | - <%= labelled_form_field(_('Lead'), f.text_area(:article_abstract, :style => 'width: 482px; height: 200px;', :class => 'mceEditor')) %> | |
14 | -</div> | |
15 | -<em><%= _('Used when a short version your text is needed.') %></em> | |
16 | - | |
17 | -<div style="margin-top: 10px;"> | |
18 | - <%= labelled_form_field(_('Text'), f.text_area(:article_body, :style => 'width:482px; height: 500px;', :class => 'mceEditor')) %> | |
19 | -</div> | |
12 | +<%= render :partial => 'shared/lead_and_body', :locals => {:tiny_mce => true, :f => f, :abstract_method => 'article_abstract', :body_method => 'article_body', :lead_id => task.id} %> | ... | ... |
config/initializers/exception_notification.rb
db/migrate/20110302214607_move_data_serialized_hash_to_setting_field_for_events.rb
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +class MoveDataSerializedHashToSettingFieldForEvents < ActiveRecord::Migration | |
2 | + def self.up | |
3 | + select_all("SELECT id FROM articles WHERE type = 'Event' AND body LIKE '%:link:%'").each do |data| | |
4 | + article = Event.find(data['id']) | |
5 | + body = '' | |
6 | + begin | |
7 | + body = YAML.load(article.body) | |
8 | + rescue | |
9 | + # do nothing | |
10 | + next | |
11 | + end | |
12 | + if body.kind_of?(Hash) | |
13 | + settings = article.setting.merge(body) | |
14 | + body = ActiveRecord::Base.sanitize_sql_for_assignment(:body => settings[:description]) | |
15 | + update("UPDATE articles set %s WHERE id = %d" % [body, article.id]) | |
16 | + setting = ActiveRecord::Base.sanitize_sql_for_assignment(:setting => settings.to_yaml) | |
17 | + update("UPDATE articles set %s WHERE id = %d" % [setting, article.id]) | |
18 | + end | |
19 | + end | |
20 | + end | |
21 | + | |
22 | + def self.down | |
23 | + say "Nothing to undo" | |
24 | + end | |
25 | +end | ... | ... |
db/schema.rb
... | ... | @@ -9,7 +9,7 @@ |
9 | 9 | # |
10 | 10 | # It's strongly recommended to check this file into your version control system. |
11 | 11 | |
12 | -ActiveRecord::Schema.define(:version => 20110228174632) do | |
12 | +ActiveRecord::Schema.define(:version => 20110302214607) do | |
13 | 13 | |
14 | 14 | create_table "action_tracker", :force => true do |t| |
15 | 15 | t.integer "user_id" |
... | ... | @@ -31,8 +31,8 @@ ActiveRecord::Schema.define(:version => 20110228174632) do |
31 | 31 | t.integer "profile_id" |
32 | 32 | end |
33 | 33 | |
34 | - add_index "action_tracker_notifications", ["action_tracker_id", "profile_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tra", :unique => true | |
35 | 34 | add_index "action_tracker_notifications", ["action_tracker_id"], :name => "index_action_tracker_notifications_on_action_tracker_id" |
35 | + add_index "action_tracker_notifications", ["profile_id", "action_tracker_id"], :name => "index_action_tracker_notifications_on_profile_id_and_action_tracker_id", :unique => true | |
36 | 36 | add_index "action_tracker_notifications", ["profile_id"], :name => "index_action_tracker_notifications_on_profile_id" |
37 | 37 | |
38 | 38 | create_table "article_versions", :force => true do |t| | ... | ... |
debian/changelog
1 | +noosfero (0.29.3) unstable; urgency=low | |
2 | + | |
3 | + * Bugfixes Version release. (Closes: AI#1760 AI#1907 AI#1899 AI#1891 AI#1904 AI#1888 AI#1869 AI#1900 AI#1914) | |
4 | + | |
5 | + -- Joenio Costa <joenio@colivre.coop.br> Fri, 11 Mar 2011 13:12:43 -0300 | |
6 | + | |
1 | 7 | noosfero (0.29.2) unstable; urgency=low |
2 | 8 | |
3 | 9 | * Bugfixes Version release. (Closes: AI#1922) | ... | ... |
etc/init.d/noosfero
... | ... | @@ -48,7 +48,7 @@ FERRET_PID_FILE=$NOOSFERO_DIR/tmp/pids/ferret.production.pid |
48 | 48 | main_script() { |
49 | 49 | cd $NOOSFERO_DIR |
50 | 50 | if [ "$NOOSFERO_USER" != "$USER" ]; then |
51 | - su $NOOSFERO_USER -c "./script/production $1" | |
51 | + su $NOOSFERO_USER -l -c "./script/production $1" | |
52 | 52 | else |
53 | 53 | ./script/production $1 |
54 | 54 | fi | ... | ... |
features/events.feature
... | ... | @@ -206,3 +206,27 @@ Feature: events |
206 | 206 | When I am on /profile/josesilva/events/2009/10/25 |
207 | 207 | Then I should see "Unpublished event" |
208 | 208 | And I should see "25" link |
209 | + | |
210 | + Scenario: events have lead field | |
211 | + Given I am logged in as "josesilva" | |
212 | + And I am on josesilva's Event creation | |
213 | + Then I should see "Lead" | |
214 | + | |
215 | + Scenario: events lead should be shown on blogs with short format | |
216 | + Given I am logged in as "josesilva" | |
217 | + And I am on josesilva's control panel | |
218 | + And I follow "Configure blog" | |
219 | + And I select "First paragraph" from "How to display posts:" | |
220 | + And I press "Save" | |
221 | + And I follow "New post" | |
222 | + And I follow "Event" | |
223 | + And I follow "Lead" | |
224 | + And I fill in the following: | |
225 | + | Title | Leaded event | | |
226 | + | Information about the event | This is the real text.| | |
227 | + | Lead | This is the abstract. | | |
228 | + And I press "Save" | |
229 | + When I am on josesilva's blog | |
230 | + Then I should see "Leaded event" | |
231 | + And I should see "This is the abstract." | |
232 | + And I should not see "This is the real text." | ... | ... |
features/suggest_article.feature
... | ... | @@ -21,3 +21,24 @@ Feature: suggest article |
21 | 21 | And I follow "Process requests" |
22 | 22 | And I should see "suggested the publication of the article" |
23 | 23 | Then I should see "Highlight this article" within ".task_box" |
24 | + | |
25 | + Scenario: an article is suggested and the admin approve it | |
26 | + Given I am on Sample Community's blog | |
27 | + And I follow "Suggest an article" | |
28 | + And I fill in the following: | |
29 | + | Title | Suggestion | | |
30 | + | Your name | Some Guy | | |
31 | + | Email | someguy@somewhere.com | | |
32 | + | Lead | This is my suggestion's lead | | |
33 | + | Text | I like free software | | |
34 | + And I press "Save" | |
35 | + And I am logged in as "joaosilva" | |
36 | + And I go to Sample Community's control panel | |
37 | + When I follow "Process requests" | |
38 | + Then I should see "suggested the publication of the article: Suggestion." | |
39 | + When I choose "Accept" | |
40 | + And I select "sample-community/Blog" from "Select the folder where the article must be published" | |
41 | + And I press "Apply!" | |
42 | + And I go to Sample Community's blog | |
43 | + Then I should see "Suggestion" | |
44 | + Then I should see "I like free software" | ... | ... |
features/support/paths.rb
... | ... | @@ -27,6 +27,12 @@ module NavigationHelpers |
27 | 27 | when /^(.*)'s homepage$/ |
28 | 28 | '/%s' % Profile.find_by_name($1).identifier |
29 | 29 | |
30 | + when /^(.*)'s blog$/ | |
31 | + '/%s/blog' % Profile.find_by_name($1).identifier | |
32 | + | |
33 | + when /^(.*)'s (.+) creation$/ | |
34 | + '/myprofile/%s/cms/new?type=%s' % [Profile.find_by_name($1).identifier,$2] | |
35 | + | |
30 | 36 | when /^(.*)'s sitemap/ |
31 | 37 | '/profile/%s/sitemap' % Profile.find_by_name($1).identifier |
32 | 38 | ... | ... |
lib/noosfero.rb
public/javascripts/article.js
1 | 1 | (function($) { |
2 | - $("#lead-button").click(function(){ | |
2 | + $(".lead-button").live('click', function(){ | |
3 | + article_id = this.getAttribute("article_id"); | |
3 | 4 | $(this).toggleClass('icon-add').toggleClass('icon-remove'); |
4 | - $('#article-lead').slideToggle(); | |
5 | + $(article_id).slideToggle(); | |
5 | 6 | return false; |
6 | 7 | }) |
7 | 8 | $("#body-button").click(function(){ | ... | ... |
public/stylesheets/application.css
test/functional/catalog_controller_test.rb
... | ... | @@ -87,4 +87,10 @@ class CatalogControllerTest < Test::Unit::TestCase |
87 | 87 | assert_tag :a, :attributes => { :href => "http://" + url}, :content => url.scan(/.{4}/).join('​') |
88 | 88 | end |
89 | 89 | |
90 | + should 'show action moved to manage_products controller' do | |
91 | + assert_raise ActionController::RoutingError do | |
92 | + get :show, :id => 1 | |
93 | + end | |
94 | + end | |
95 | + | |
90 | 96 | end | ... | ... |
test/integration/exception_notification_test.rb
... | ... | @@ -9,9 +9,9 @@ class ExceptionNotificationTest < ActionController::IntegrationTest |
9 | 9 | ActionMailer::Base.delivery_method = :test |
10 | 10 | ActionMailer::Base.perform_deliveries = true |
11 | 11 | ActionMailer::Base.deliveries = [] |
12 | - AccountController.any_instance.stubs(:signup).raises(RuntimeError) | |
13 | - AccountController.any_instance.stubs(:local_request?).returns(false) | |
14 | - AccountController.any_instance.stubs(:consider_all_requests_local).returns(false) | |
12 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:signup).raises(RuntimeError)} | |
13 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:local_request?).returns(false)} | |
14 | + [ProfileController, AccountController].each{|klass| klass.any_instance.stubs(:consider_all_requests_local).returns(false)} | |
15 | 15 | end |
16 | 16 | |
17 | 17 | should 'deliver mail notification about exceptions' do | ... | ... |
test/unit/content_viewer_helper_test.rb
... | ... | @@ -46,6 +46,20 @@ class ContentViewerHelperTest < Test::Unit::TestCase |
46 | 46 | assert_no_match /a href='#{article.url}'>#{article.name}</, result |
47 | 47 | end |
48 | 48 | |
49 | + should 'not create link to comments if called with no_comments' do | |
50 | + blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | |
51 | + article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id) | |
52 | + result = article_title(article, :no_comments => true) | |
53 | + assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | |
54 | + end | |
55 | + | |
56 | + should 'not create link to comments if the article doesn\'t allow comments' do | |
57 | + blog = fast_create(Blog, :name => 'Blog test', :profile_id => profile.id) | |
58 | + article = fast_create(TextileArticle, :name => 'art test', :profile_id => profile.id, :parent_id => blog.id, :accept_comments => false) | |
59 | + result = article_title(article) | |
60 | + assert_no_match(/a href='.*comments_list.*>No comments yet</, result) | |
61 | + end | |
62 | + | |
49 | 63 | should 'count total of comments from post' do |
50 | 64 | article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile) |
51 | 65 | article.stubs(:url).returns({}) |
... | ... | @@ -54,6 +68,14 @@ class ContentViewerHelperTest < Test::Unit::TestCase |
54 | 68 | assert_match /One comment/, result |
55 | 69 | end |
56 | 70 | |
71 | + should 'not display total of comments if the article doesn\'t allow comments' do | |
72 | + article = TextileArticle.new(:name => 'first post for test', :body => 'first post for test', :profile => profile, :accept_comments => false) | |
73 | + article.stubs(:url).returns({}) | |
74 | + article.stubs(:comments).returns([Comment.new(:author => profile, :title => 'test', :body => 'test')]) | |
75 | + result = link_to_comments(article) | |
76 | + assert_equal '', result | |
77 | + end | |
78 | + | |
57 | 79 | should 'not list feed article' do |
58 | 80 | profile.articles << Blog.new(:name => 'Blog test', :profile => profile) |
59 | 81 | assert_includes profile.blog.children.map{|i| i.class}, RssFeed | ... | ... |
test/unit/search_helper_test.rb
... | ... | @@ -55,6 +55,14 @@ class SearchHelperTest < Test::Unit::TestCase |
55 | 55 | assert_tag_in_string result, :tag => 'a', :attributes => {:href => /:id=>#{product2.id}/}, :content => product2.name |
56 | 56 | end |
57 | 57 | |
58 | + should 'link to manage_products controller on display_profile_info' do | |
59 | + enterprise = fast_create(Enterprise) | |
60 | + product = fast_create(Product, :enterprise_id => enterprise.id) | |
61 | + result = display_profile_info(enterprise) | |
62 | + assert_tag_in_string result, :tag => 'a', :attributes => {:href => /:controller=>\"manage_products\"/}, :content => product.name | |
63 | + assert_no_tag_in_string result, :tag => 'a', :attributes => {:href => /:id=>\"catalog\"/}, :content => product.name | |
64 | + end | |
65 | + | |
58 | 66 | protected |
59 | 67 | include NoosferoTestHelper |
60 | 68 | ... | ... |
test/unit/uploaded_file_test.rb
... | ... | @@ -275,4 +275,22 @@ class UploadedFileTest < Test::Unit::TestCase |
275 | 275 | assert_nil ActionTracker::Record.last(:conditions => { :verb => "upload_image" }) |
276 | 276 | end |
277 | 277 | |
278 | + should 'not crash if first paragraph called' do | |
279 | + f = fast_create(UploadedFile) | |
280 | + assert_nothing_raised do | |
281 | + f.first_paragraph | |
282 | + end | |
283 | + end | |
284 | + | |
285 | + should 'return empty string to lead if no abstract given' do | |
286 | + f = fast_create(UploadedFile, :abstract => nil) | |
287 | + assert_equal '', f.lead | |
288 | + end | |
289 | + | |
290 | + should 'survive when try to get icon_name from a file with mime_type nil' do | |
291 | + f = UploadedFile.new | |
292 | + f.expects(:mime_type).returns(nil) | |
293 | + assert_equal 'upload-file', UploadedFile.icon_name(f) | |
294 | + end | |
295 | + | |
278 | 296 | end | ... | ... |