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:
@ -28,11 +28,12 @@ describe CommentsController do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context 'with additional params' do
|
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
|
it 'applies the permitted changes' do
|
||||||
expect(updated_comment.row).not_to eq(5)
|
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.row).to eq(1)
|
||||||
expect(updated_comment.file_id).to eq(comment.file_id)
|
expect(updated_comment.file_id).to eq(comment.file_id)
|
||||||
expect(updated_comment.text).to eq('test100')
|
expect(updated_comment.text).to eq('test100')
|
||||||
|
Reference in New Issue
Block a user