Commit fbe9c8769b84012dc09f69e5976275c054d564bf

Authored by Joenio Costa
Committed by Daniela Feitosa
1 parent cf4d226c

Showing selected article in editing ArticleBlock

(ActionItem1957)
app/views/box_organizer/_article_block.rhtml
... ... @@ -5,6 +5,6 @@
5 5 </p>
6 6 <% else %>
7 7 <% articles = @block.available_articles.select {|article| !article.folder? } %>
8   - <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]})) %>
  8 + <%= select_tag('block[article_id]', options_for_select_with_title(articles.map {|item| [item.path, item.id]}, @block.article ? @block.article.id : nil)) %>
9 9 <% end %>
10 10 </div>
... ...
test/functional/profile_design_controller_test.rb
... ... @@ -401,4 +401,11 @@ class ProfileDesignControllerTest &lt; Test::Unit::TestCase
401 401 assert_equal [], @controller.available_blocks - ENTERPRISE_BLOCKS_WITH_PRODUCTS_ENABLE
402 402 end
403 403  
  404 + should 'editing article block displays right selected article' do
  405 + selected_article = fast_create(Article, :profile_id => profile.id)
  406 + ArticleBlock.any_instance.stubs(:article).returns(selected_article)
  407 + get :edit, :profile => 'designtestuser', :id => @b1.id
  408 + assert_tag :tag => 'option', :attributes => {:value => selected_article.id, :selected => 'selected'}
  409 + end
  410 +
404 411 end
... ...