Permalink
Browse files

Merge pull request #14 from seattlerb/record-talk-suggester

Record talk suggester
  • Loading branch information...
2 parents b7d89a4 + 3d364c3 commit 3a26969516115f0892d68f48da7ad3b7800a7976 @zenspider zenspider committed Apr 10, 2013
@@ -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>
@@ -0,0 +1,5 @@
+class AddSuggesterToSuggestions < ActiveRecord::Migration
+ def change
+ add_column :suggestions, :suggester, :string
+ end
+end
View
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130124033130) do
+ActiveRecord::Schema.define(:version => 20130408194405) do
create_table "affiliations", :force => true do |t|
t.integer "dude_id"
@@ -59,6 +59,7 @@
t.string "title"
t.datetime "created_at"
t.datetime "updated_at"
+ t.string "suggester"
end
create_table "talks", :force => true do |t|
@@ -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
@@ -2,7 +2,7 @@
class SuggestionTest < MiniTest::Rails::ActiveSupport::TestCase
def test_valid
- suggestion = Suggestion.new(:title => "WOOT")
+ suggestion = Suggestion.new(:title => "WOOT", :suggester => "Fred")
assert suggestion.valid?
end

0 comments on commit 3a26969

Please sign in to comment.