0

I am trying to run basic controller test.

My controller_spec.rb looks like:

class Test < ActionController::Base
  def test_meth
    puts 'hello for test meth'
    head 200
  end
end

describe Test do
  it 'responds with 200' do
    get :test_meth
    expect(response.status).to eq(200)
  end
end

When I run this spec I end up with an error

ActionController::UrlGenerationError: No route matches {:action=>"test_meth", :controller=>"test"}

I am not sure if I am missing something very basic here becasue this looks very straight forward. Any help is much appreciated.

1 Answer 1

0

The error is clear, in your routes.rb file you have not written the action correctly.

You must have.

get "test", to: "test#test_meth"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.