Skip to content
Browse files

Add list of categories. Fixes #20, pending test #21.

  • Loading branch information...
1 parent 84ff894 commit 7cf70f1a55799062cab417039224232c13c71477 @terenceponce committed Apr 20, 2012
Showing with 9 additions and 0 deletions.
  1. +7 −0 app/views/articles/show.html.erb
  2. +2 −0 spec/requests/articles_pages_spec.rb
View
7 app/views/articles/show.html.erb
@@ -9,6 +9,13 @@
<%= link_to @article.author.name, @article.author %>
<% end %>
on <%= l(@article.created_at, :format => :friendly_date) %>
+ <br />
+ <% if @article.categories.any? %>
+ <%= @article.categories.count == 1 ? 'Category' : 'Category'.pluralize %>:
+ <% @article.categories.each do |category| %>
+ <%= link_to category.name, category %>
+ <% end %>
+ <% end %>
</small>
</h1>
<section class="article-content">
View
2 spec/requests/articles_pages_spec.rb
@@ -26,6 +26,8 @@
it { should have_page_title @article.title }
it { should have_page_heading @article.title }
+ it 'should have the link of the categories'
+ # it { should have_link @article.categories.first.name }
it { should have_link 'Back to articles' }
it { should_not have_link 'Edit' }
it { should_not have_link 'Destroy' }

0 comments on commit 7cf70f1

Please sign in to comment.
Something went wrong with that request. Please try again.