Commit 19945d2e1bd0d80cc9ba71a53ecac17123e42993

Authored by Victor Costa
1 parent d700982f

rails3: fix some functional tests

Output fields_for tags
app/helpers/application_helper.rb
@@ -641,7 +641,7 @@ module ApplicationHelper @@ -641,7 +641,7 @@ module ApplicationHelper
641 cat.full_name_without_leading(1, " → "), 641 cat.full_name_without_leading(1, " → "),
642 "#{object_name}[category_ids][]", cat.id, 642 "#{object_name}[category_ids][]", cat.id,
643 object.category_ids.include?(cat.id), :id => checkbox_id, 643 object.category_ids.include?(cat.id), :id => checkbox_id,
644 - :onchange => 'this.parentNode.className=(this.checked?"cat_checked":"")' ), 644 + :onchange => j('this.parentNode.className=(this.checked?"cat_checked":"")') ),
645 :class => ( object.category_ids.include?(cat.id) ? 'cat_checked' : '' ) ) + "\n" 645 :class => ( object.category_ids.include?(cat.id) ? 'cat_checked' : '' ) ) + "\n"
646 end 646 end
647 end 647 end
app/helpers/boxes_helper.rb
@@ -227,7 +227,7 @@ module BoxesHelper @@ -227,7 +227,7 @@ module BoxesHelper
227 227
228 # DEPRECATED. Do not use this. 228 # DEPRECATED. Do not use this.
229 def import_blocks_stylesheets(options = {}) 229 def import_blocks_stylesheets(options = {})
230 - @blocks_css_files ||= current_blocks.map{|b|'blocks/' + block.class.name.to_css_class}.uniq 230 + @blocks_css_files ||= current_blocks.map{|block|'blocks/' + block.class.name.to_css_class}.uniq
231 stylesheet_import(@blocks_css_files, options) 231 stylesheet_import(@blocks_css_files, options)
232 end 232 end
233 def block_css_classes(block) 233 def block_css_classes(block)
app/views/categories/_form.html.erb
@@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
19 19
20 <%= labelled_check_box(_('Display in the menu'), 'category[display_in_menu]', '1', @category.display_in_menu) %> 20 <%= labelled_check_box(_('Display in the menu'), 'category[display_in_menu]', '1', @category.display_in_menu) %>
21 21
22 - <% f.fields_for :image_builder, @category.image do |i| %> 22 + <%= f.fields_for :image_builder, @category.image do |i| %>
23 <%= file_field_or_thumbnail(_('Image:'), @category.image, i) %> 23 <%= file_field_or_thumbnail(_('Image:'), @category.image, i) %>
24 <% end %> 24 <% end %>
25 25
app/views/cms/_blog.html.erb
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 54
55 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10)) %> 55 <%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 10)) %>
56 56
57 -<% f.fields_for :image_builder, @article.image do |i| %> 57 +<%= f.fields_for :image_builder, @article.image do |i| %>
58 <%= file_field_or_thumbnail(_('Cover image:'), @article.image, i)%> 58 <%= file_field_or_thumbnail(_('Cover image:'), @article.image, i)%>
59 <%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> 59 <%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
60 <% end %> 60 <% end %>
@@ -69,12 +69,12 @@ @@ -69,12 +69,12 @@
69 69
70 <%= labelled_check_box(_("List only translated posts"), 'article[display_posts_in_current_language]', '1', @article.display_posts_in_current_language?) %> 70 <%= labelled_check_box(_("List only translated posts"), 'article[display_posts_in_current_language]', '1', @article.display_posts_in_current_language?) %>
71 71
72 -<% f.fields_for 'feed', @article.feed do |feed| %> 72 +<%= f.fields_for 'feed', @article.feed do |feed| %>
73 <%= labelled_form_field(_('Limit of posts in RSS Feed'), feed.select(:limit, [5, 10, 20, 50])) %> 73 <%= labelled_form_field(_('Limit of posts in RSS Feed'), feed.select(:limit, [5, 10, 20, 50])) %>
74 <%= labelled_form_field(_('Include in RSS Feed only posts from language:'), feed.select(:language, [[_('All'), nil ]] + environment.locales.map { |k,v| [v, k]})) %> 74 <%= labelled_form_field(_('Include in RSS Feed only posts from language:'), feed.select(:language, [[_('All'), nil ]] + environment.locales.map { |k,v| [v, k]})) %>
75 <% end %> 75 <% end %>
76 76
77 -<% f.fields_for 'external_feed_builder', @article.external_feed do |efeed| %> 77 +<%= f.fields_for 'external_feed_builder', @article.external_feed do |efeed| %>
78 <div id='fetch-external-feed'> 78 <div id='fetch-external-feed'>
79 <% enabled = @article.external_feed && @article.external_feed.enabled %> 79 <% enabled = @article.external_feed && @article.external_feed.enabled %>
80 <% only_once = @article.external_feed ? @article.external_feed.only_once : true %> 80 <% only_once = @article.external_feed ? @article.external_feed.only_once : true %>
app/views/manage_products/_edit_image.html.erb
@@ -3,7 +3,7 @@ @@ -3,7 +3,7 @@
3 </div> 3 </div>
4 4
5 <%= form_for(:product, :url => { :controller => 'manage_products', :action => 'edit', :id => @product, :field => 'image' }, :html => { :method => 'post', :id => 'uploadForm', :multipart => true}) do |f| %> 5 <%= form_for(:product, :url => { :controller => 'manage_products', :action => 'edit', :id => @product, :field => 'image' }, :html => { :method => 'post', :id => 'uploadForm', :multipart => true}) do |f| %>
6 - <% f.fields_for :image_builder, @product.image do |i| %> 6 + <%= f.fields_for :image_builder, @product.image do |i| %>
7 <%= i.file_field( :uploaded_data, { :size => 10 } ) %> 7 <%= i.file_field( :uploaded_data, { :size => 10 } ) %>
8 <p><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %></p> 8 <p><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %></p>
9 <% end %> 9 <% end %>
app/views/manage_products/_form.html.erb
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <%= display_form_field( _('Price:'), f.text_field(:price) ) %> 7 <%= display_form_field( _('Price:'), f.text_field(:price) ) %>
8 <%= display_form_field( _('Description:'), f.text_area(:description, :rows => 10, :class => 'mceEditor') ) %> 8 <%= display_form_field( _('Description:'), f.text_area(:description, :rows => 10, :class => 'mceEditor') ) %>
9 <%= labelled_form_field(f.check_box(:highlighted) + _('Highlight this product'),'') %> 9 <%= labelled_form_field(f.check_box(:highlighted) + _('Highlight this product'),'') %>
10 - <% f.fields_for :image_builder, @product.image do |i| %> 10 + <%= f.fields_for :image_builder, @product.image do |i| %>
11 <%= file_field_or_thumbnail(_('Image:'), @product.image, i) %> 11 <%= file_field_or_thumbnail(_('Image:'), @product.image, i) %>
12 <% end %> 12 <% end %>
13 13
app/views/memberships/new_community.html.erb
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 24
25 <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'community', :profile => @community } %> 25 <%= render :partial => 'shared/organization_custom_fields', :locals => { :f => f, :object_name => 'community', :profile => @community } %>
26 26
27 - <% f.fields_for :image_builder, @community.image do |i| %> 27 + <%= f.fields_for :image_builder, @community.image do |i| %>
28 <%= file_field_or_thumbnail(_('Image:'), @community.image, i) %> 28 <%= file_field_or_thumbnail(_('Image:'), @community.image, i) %>
29 <% end %> 29 <% end %>
30 30
app/views/profile_editor/edit.html.erb
@@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
17 <span><%= unchangeable_privacy_field @profile %></span> 17 <span><%= unchangeable_privacy_field @profile %></span>
18 </div> 18 </div>
19 <div id="profile_change_picture"> 19 <div id="profile_change_picture">
20 - <% f.fields_for :image_builder, @profile.image do |i| %> 20 + <%= f.fields_for :image_builder, @profile.image do |i| %>
21 <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %> 21 <%= file_field_or_thumbnail(_('Image:'), @profile.image, i) %><%= _("Max size: %s (.jpg, .gif, .png)")% Image.max_size.to_humanreadable %>
22 <% end %> 22 <% end %>
23 </div> 23 </div>
app/views/shared/_lead_and_body.html.erb
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 <% f ||= false%> 8 <% f ||= false%>
9 9
10 <% if @article %> 10 <% if @article %>
11 - <% fields_for 'article[image_builder]', @article.image do |i| %> 11 + <%= fields_for 'article[image_builder]', @article.image do |i| %>
12 <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %> 12 <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %>
13 <% end %> 13 <% end %>
14 <% end %> 14 <% end %>
app/views/tasks/_task.html.erb
@@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
28 <%= task_information(task) %> 28 <%= task_information(task) %>
29 </div> 29 </div>
30 30
31 - <% fields_for "tasks[#{task.id}][task]", task do |f| %> 31 + <%= fields_for "tasks[#{task.id}][task]", task do |f| %>
32 <% if task.accept_details %> 32 <% if task.accept_details %>
33 <div id="on-accept-information-<%=task.id%>" style="display: none"> 33 <div id="on-accept-information-<%=task.id%>" style="display: none">
34 <%= render :partial => partial_for_class(task.class, nil, :accept_details), :locals => {:task => task, :f => f} %> 34 <%= render :partial => partial_for_class(task.class, nil, :accept_details), :locals => {:task => task, :f => f} %>
test/functional/cms_controller_test.rb
@@ -521,7 +521,7 @@ class CmsControllerTest &lt; ActionController::TestCase @@ -521,7 +521,7 @@ class CmsControllerTest &lt; ActionController::TestCase
521 521
522 should 'sanitize tags' do 522 should 'sanitize tags' do
523 post :new, :type => 'TextileArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...', :tag_list => 'tag1, <strong>tag2</strong>' } 523 post :new, :type => 'TextileArticle', :profile => profile.identifier, :article => { :name => 'a test article', :body => 'the text of the article ...', :tag_list => 'tag1, <strong>tag2</strong>' }
524 - assert_sanitized assigns(:article).tag_list.names.join(', ') 524 + assert_sanitized assigns(:article).tag_list.join(', ')
525 end 525 end
526 526
527 should 'keep informed parent_id' do 527 should 'keep informed parent_id' do
test/functional/themes_controller_test.rb
@@ -166,7 +166,7 @@ class ThemesControllerTest &lt; ActionController::TestCase @@ -166,7 +166,7 @@ class ThemesControllerTest &lt; ActionController::TestCase
166 theme = Theme.create('mytheme', :owner => profile); theme.update_css('test.css', '/* sample code */') 166 theme = Theme.create('mytheme', :owner => profile); theme.update_css('test.css', '/* sample code */')
167 get :css_editor, :profile => 'testinguser', :id => 'mytheme', :css => 'test.css' 167 get :css_editor, :profile => 'testinguser', :id => 'mytheme', :css => 'test.css'
168 168
169 - assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/update_css/mytheme' }, :descendant => { :tag => 'textarea', :content => '/* sample code */' } 169 + assert_tag :tag => 'form', :attributes => { :action => '/myprofile/testinguser/themes/update_css/mytheme' }, :descendant => { :tag => 'textarea', :content => /\/\* sample code \*\// }
170 end 170 end
171 171
172 should 'be able to save CSS code' do 172 should 'be able to save CSS code' do
@@ -250,7 +250,7 @@ class ThemesControllerTest &lt; ActionController::TestCase @@ -250,7 +250,7 @@ class ThemesControllerTest &lt; ActionController::TestCase
250 250
251 LayoutTemplate.expects(:all).returns(all) 251 LayoutTemplate.expects(:all).returns(all)
252 get :index, :profile => 'testinguser' 252 get :index, :profile => 'testinguser'
253 - assert_same all, assigns(:layout_templates) 253 + assert_equal all, assigns(:layout_templates)
254 end 254 end
255 255
256 should 'display links to set template' do 256 should 'display links to set template' do