Permalink
Browse files

Include the suggester on the topic suggestion form

  • Loading branch information...
thagomizer committed Apr 10, 2013
1 parent 1e8fddc commit 3d364c366ada60360730398c2a20938402529301
@@ -15,6 +15,10 @@
<%= f.label :topic %><br />
<%= f.text_field :title %>
</div>
+ <div class="field">
+ <%= f.label :your_name %><br />
+ <%= f.text_field :suggester %>
+ </div>
<div class="actions">
<%= f.submit %>
</div>
@@ -5,11 +5,13 @@ This is a list of topics and questions that people in Seattle.rb would like to h
<table style="margin-left: 10px;">
<tr>
<th style="text-align: left; font-size: 16px">Topic</th>
+ <th style="text-align: left; font-size: 16px">Suggested By</th>
</tr>
<% @suggestions.each do |suggestion| %>
<tr>
<td><%= suggestion.title %></td>
+ <td><%= suggestion.suggester %></td>
</tr>
<% end %>
</table>
@@ -10,16 +10,26 @@ def test_index
get :index
assert_response :success
assert_not_nil assigns(:suggestions)
+
+ body = response.body
+
+ Suggestion.all.each do |suggestion|
+ assert_includes body, suggestion.title
+ assert_includes body, suggestion.suggester
+ end
end
def test_new
get :new
assert_response :success
+
+ assert_select "input#suggestion_title"
+ assert_select "input#suggestion_suggester"
end
def test_create
assert_difference('Suggestion.count', 1) do
- post :create, suggestion: {:title => "My title" }
+ post :create, suggestion: {:title => "My title", :suggester => "Barney Rubble" }
end
assert_redirected_to suggestions_path
end
@@ -2,7 +2,9 @@
# http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
one:
- title: MyString
-
+ title: Suggestion One
+ suggester: Barney Rubble
+
two:
- title: MyString
+ title: Suggestion Two
+ suggester: Fred Flintstone

0 comments on commit 3d364c3

Please sign in to comment.