0
테스트 프로그램에 thoughtbot 소개를하고 있습니다. 그들이 원하는 것을 테스트하는 방법을 모르겠다.레일 컨트롤러 테스트
다음은 제 테스트입니다.
require "rails_helper"
describe PeopleController do
describe "#create" do
context "when person is valid" do
it "redirects to #show" do
post :create, FactoryGirl.build_stubbed(:person)
expect(response).to redirect_to(show_people_path)
end
end
context "when person is invalid" do
it "redirects to #new" do
pending "create this test"
end
end
end
end
물론 공장 소녀를 사용하고 있습니다. 몇 가지 방법을 시도했습니다. 나는이 컨트롤러를 테스트하기 위해 괭이를 정말로 모른다.
어떤 통찰력도 좋을 것입니다.
감사에서
person.rb : 모델의 검증에 따라, 당신은 단순히 뭔가를 할 수 있습니다. 이것은 이제 더 이해가됩니다. 그러나 내 터미널 초기화되지 않은 상수 FactoryGirl 오류 던지고있다 ... hrm .. –