Skip to content

Conversation

@ksilex
Copy link
Owner

@ksilex ksilex commented Mar 3, 2021

No description provided.

it 'saves a new answer in the database' do
expect { post :create, params: { answer: attributes_for(:answer),
question_id: answer.question }
}.to change(Answer, :count).by(1)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут стоит в change указать question.answers, чтобы сразу проверить, что ответ связывается с вопросом

body { "MyString" }
question { nil }
body { "MyText" }
association :question

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

если имя ассоциации и фабрики совпадает, то можно вместо association :question писать просто question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants