Improve comments controller spec

For this test, we had a bug so that the test could passed if executed, so that the file just had ID 50 randomly.
This commit is contained in:
Sebastian Serth
2023-08-01 12:03:49 +02:00
parent d6217c422e
commit f15d4fe437

View File

@ -28,11 +28,12 @@ describe CommentsController do
end
context 'with additional params' do
let(:comment_params) { {text: 'test100', row: 5, file_id: 50} }
let(:file) { create(:file) }
let(:comment_params) { {text: 'test100', row: 5, file_id: file.id} }
it 'applies the permitted changes' do
expect(updated_comment.row).not_to eq(5)
expect(updated_comment.file_id).not_to eq(50)
expect(updated_comment.file_id).not_to eq(file.id)
expect(updated_comment.row).to eq(1)
expect(updated_comment.file_id).to eq(comment.file_id)
expect(updated_comment.text).to eq('test100')