Added creator to scientific name views etc

This commit is contained in:
Skud
2013-08-21 17:52:10 +10:00
parent a5b2db3458
commit 836ed7aa85
3 changed files with 11 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ class ScientificNamesController < ApplicationController
# POST /scientific_names
# POST /scientific_names.json
def create
params[:scientific_name][:creator_id] = current_member.id
@scientific_name = ScientificName.new(params[:scientific_name])
respond_to do |format|

View File

@@ -1,3 +1,9 @@
- content_for :title, "Edit scientific name"
%p
Added by
= @scientific_name.creator
= distance_of_time_in_words(@scientific_name.created_at, Time.zone.now)
ago.
= render 'form'

View File

@@ -12,6 +12,10 @@ describe "scientific_names/edit" do
render
end
it "shows the creator" do
rendered.should contain "Added by #{@scientific_name.creator} less than a minute ago."
end
it "renders the edit scientific_name form" do
assert_select "form", :action => scientific_names_path(@scientific_name), :method => "post" do
assert_select "input#scientific_name_scientific_name", :name => "scientific_name[scientific_name]"