工場の女の子のコース >> レベル >> とステップを定義しました。ステップはレベルに属し、レベルはコースに属します (それぞれに has_many 関係があります)。
ここにエラーがあります(どこから始めればよいかさえわかりません):
Failure/Error: before { visit course_level_step_path(course.id, level.id, step.id)}
ActionView::Template::Error:
0x003fe5daf528a0 is not id value
これが私の必要なルートです:
course_level_step GET /courses/:course_id/levels/:level_id/steps/:id(.:format) steps#show
ここに私のrspec:
describe "attempting a step" do
let(:course) { FactoryGirl.create(:course)}
let(:level) { FactoryGirl.create(:level)}
let(:step) { FactoryGirl.create(:step)}
before { sign_in user}
describe "taking a course" do
before { visit course_level_step_path(course.id, level.id, step.id)} <<< here is the problem
it "should increment the user step count" do
expect do
click_button "check answer"
end.to change(user.user_steps, :count).by(1)
end
describe "toggling the button" do
before { click_button "check answer"}
it { should have_selector('input', value: 'remove step')}
end
end
ここに私の工場があります:
FactoryGirl.define do
factory :user do
sequence(:name) { |n| "Person #{n}" }
sequence(:email) { |n| "person_#{n}@example.com" }
password "foobar"
password_confirmation "foobar"
factory :admin do
admin true
end
end
factory :course do
sequence(:title) { |n| "Ze Finance Course #{n}" }
sequence(:description) { |n| "Description for course #{n}" }
end
factory :level do
course
sequence(:title) { |n| "Ze Finance Level #{n}" }
end
factory :step do
level
sequence(:description) { |n| "Description for course #{n}" }
end
end
エラーとその解決方法に関するガイダンスをいただければ幸いです。