-1

I have been stuck on this for near 4 hours now. In the chapter we are asked to run tests for the first time. It is outputting two errors, and I don't understand what they are.

These are the errors:

Finished in 0.097197s, 20.5768 runs/s, 0.0000 assertions/s.



1) Error:
StaticPagesControllerTest#test_should_get_help:
AbstractController::Helpers::MissingHelperError: Missing helper file helpers//users/kevinmulhern/documents/the_odin_project/ruby_on_rails/sample_app/app/helpers/application_helper.rb_helper.rb
    app/controllers/application_controller.rb:1:in `<top (required)>'
    app/controllers/static_pages_controller.rb:1:in `<top (required)>'


  2) Error:
StaticPagesControllerTest#test_should_get_home:
ActionView::MissingTemplate: Missing template static_pages/home, application/home with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/Users/kevinmulhern/.rvm/gems/ruby-2.2.0/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates"
  * "/Users/kevinmulhern/documents/the_odin_project/ruby_on_rails/sample_app/app/views"
  * "/Users/kevinmulhern/.rvm/gems/ruby-2.2.0/gems/web-console-2.0.0.beta3/app/views"

    test/controllers/static_pages_controller_test.rb:5:in `block in <class:StaticPagesControllerTest>'

2 runs, 0 assertions, 0 failures, 2 errors, 0 skips

I ended up scraping the app as I wasnt that far through it anyway and copy and pasted my way back to the section I got stuck at, I dont think it could be a typo causing this.

heres the controller for the StaticPages

class StaticPagesController < ApplicationController
  def home
  end

  def help
  end
end

and finally here is the test file:

require 'test_helper'

class StaticPagesControllerTest < ActionController::TestCase
  test "should get home" do
    get :home
    assert_response :success
  end

  test "should get help" do
    get :help
    assert_response :success
  end
end

Any help at all would be greatly appreciated.

updated error after deleting the helpers:

1) Error:
StaticPagesControllerTest#test_should_get_home:
ActionView::MissingTemplate: Missing template static_pages/home, application/home with {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. Searched in:
  * "/Users/kevinmulhern/.rvm/gems/ruby-2.2.0/gems/web-console-2.0.0.beta3/lib/action_dispatch/templates"
  * "/Users/kevinmulhern/documents/the_odin_project/ruby_on_rails/sample_app/app/views"
  * "/Users/kevinmulhern/.rvm/gems/ruby-2.2.0/gems/web-console-2.0.0.beta3/app/views"

    test/controllers/static_pages_controller_test.rb:5:in `block in <class:StaticPagesControllerTest>

update

I moved the project to my home directory, and that solved the problem. There must have been something wrong with my directory structure.

  • possible duplicate of [Rails: AbstractController::Helpers::MissingHelperError - Missing helper file application\_helper.rb\_helper.rb](http://stackoverflow.com/questions/27884908/rails-abstractcontrollerhelpersmissinghelpererror-missing-helper-file-app) – sebkkom Mar 18 '15 at 14:17

1 Answers1

0

For your first error, without looking at any code or anything else I can tell you that this: //users/kevinmulhern/documents/the_odin_project/ruby_on_rails/sample_app/app/helpers/application_helper.rb_helper.rb smells bad (notice the two .rb occurrences in the application_helper.rb_helper.rb part) update: Check this similar question.

For the second one, your error message is this: ActionView::MissingTemplate: Missing template static_pages/home. Have a look around for what missing template means. (hint: do you have a static_pages/home.html.erb file?)

Community
  • 1
  • 1
sebkkom
  • 1,426
  • 17
  • 31
  • Hi thanks for replying, I changed the application helper file name to application_helper.rb but that hasn't fixed it unfortunately. Yeah the static_pages/home.html.erb file is there. – Kevin Mulhern Mar 17 '15 at 20:53
  • Can you update the question with the new error message you are getting for application_helper? – sebkkom Mar 17 '15 at 20:58
  • I took out both the applicatio_helper and the static_pages_helper and now its showing another template error. Ill add the error to the post. – Kevin Mulhern Mar 17 '15 at 21:05