Hello, there is such a test:
it "renders show template if an item is found" do question = Question.create get :show, {id: question.id} expect(response).to render_template(assigns(:question)) end The factory is responsible for creating the question.
FactoryGirl.define do factory :question do title "test title" description "Test description" visitors 5 association(:user) end end The model has two lines of validation:
validates :title, presence: true validates :description, presence: true The show method simply displays the question. Please explain why an error occurs:
1) QuestionsController Show action renders show template if an item is found Failure/Error: get :show, {id: question.id} ActionController::UrlGenerationError: No route matches {:action=>"show", :controller=>"questions", :id=>nil} On the site, adding a question works.