add tests for forbidden and not found text
This commit is contained in:
parent
03a33e1ef6
commit
a71cd641dc
1 changed files with 19 additions and 0 deletions
|
|
@ -55,4 +55,23 @@ describe('The user text detail page', () => {
|
|||
expect(response.status).to.eq(403)
|
||||
})
|
||||
})
|
||||
|
||||
it('non-owner sees forbidden message when viewing another user text', () => {
|
||||
cy.loginAsSecondUser()
|
||||
cy.intercept('GET', '/api/texts/0').as('getText')
|
||||
cy.visit('/texts/0')
|
||||
cy.wait('@getText')
|
||||
cy.get('#text-detail').should(
|
||||
'contain',
|
||||
"You don't have permission to view this text"
|
||||
)
|
||||
})
|
||||
|
||||
it('user sees not found for non-existent text', () => {
|
||||
cy.loginAsUser()
|
||||
cy.intercept('GET', '/api/texts/999').as('getText')
|
||||
cy.visit('/texts/999')
|
||||
cy.wait('@getText')
|
||||
cy.get('#text-detail').should('contain', 'Text not found')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue