Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Adeeb Shah
1,281 PointsActionView::Template::Error: undefined method `full_name' for nil:NilClass
Hey guys, get this error when running the test during Testing the whole application... this is the full error I get when running status_controller_test.rb
1) Error:
test_should_get_index(StatusesControllerTest):
ActionView::Template::Error: undefined method full_name' for nil:NilClass
/Users/Adeeb/Documents/projectbook/app/views/statuses/index.html.erb:7:in
block in app_views_statuses_index_html_erb375377265955682562_2168779700'
/Users/Adeeb/Documents/projectbook/app/views/statuses/index.html.erb:5:in each'
/Users/Adeeb/Documents/projectbook/app/views/statuses/index.html.erb:5:in
_app_views_statuses_index_html_erb_375377265955682562_2168779700'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/template.rb:145:in block in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in
block in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in
instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/template.rb:143:in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:47:in
block (2 levels) in render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/abstract_renderer.rb:38:in block in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in
block in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications/instrumenter.rb:20:in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in
instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/abstract_renderer.rb:38:in instrument'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:46:in
block in render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:54:in render_with_layout'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:45:in
render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:18:in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/renderer.rb:36:in
render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_view/renderer/renderer.rb:17:in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:110:in
_render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_controller/metal/streaming.rb:225:in _render_template'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:103:in
render_to_body'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_controller/metal/renderers.rb:28:in render_to_body'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_controller/metal/compatibility.rb:50:in
render_to_body'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:88:in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:16:in
render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:40:in block (2 levels) in render'
/usr/local/rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.12/lib/active_support/core_ext/benchmark.rb:5:in
block in ms'
Anyone else come across this?
3 Answers

Thomas Slater
5,094 PointsHey there - it's usually a good idea to show some code in context to your error. Also, it helps for readability if you format it with 4 spaces to make it "code".

Adeeb Shah
1,281 PointsHey, this is my status.controller_test.rb file:
require 'test_helper'
class StatusesControllerTest < ActionController::TestCase setup do @status = statuses(:one) end
test "should get index" do get :index assert_response :success assert_not_nil assigns(:statuses) end
test "should get new" do get :new assert_response :redirect assert_redirected_to new_user_session_path end
test "should create status" do assert_difference('Status.count') do post :create, status: { content: @status.content } end
assert_redirected_to status_path(assigns(:status))
end
test "should show status" do get :show, id: @status assert_response :success end
test "should get edit" do get :edit, id: @status assert_response :success end
test "should update status" do put :update, id: @status, status: { content: @status.content } assert_redirected_to status_path(assigns(:status)) end
test "should destroy status" do assert_difference('Status.count', -1) do delete :destroy, id: @status end
assert_redirected_to statuses_path
end end

Stephen Lee
20,122 PointsI was having this problem too. I had forgotten that in a previous lesson we put this in the users.yml file:
jason:
first_name: "Jason"
last_name: "Seifer"
email: "jason@teamtreehouse.com"
profile_name: "jasonseifer"
So because of that I had to use the name "jason" in the statuses.yml file, just like the video said:
one:
content: MyText
user: jason
two:
content: MyText
user: jason