add test to ensure that userA cannot see drafts stream of userB

This commit is contained in:
pmusaraj 2018-09-12 10:13:20 -04:00
parent 38668818a5
commit 3a00c2adeb

View File

@ -24,4 +24,15 @@ describe DraftsController do
parsed = JSON.parse(response.body) parsed = JSON.parse(response.body)
expect(parsed["drafts"].length).to eq(0) expect(parsed["drafts"].length).to eq(0)
end end
it 'does not let userA see drafts by userB' do
userB = Fabricate(:user)
Draft.set(userB, 'xxx', 0, '{}')
userA = sign_in(Fabricate(:user))
get "/drafts.json", params: { username: userB.username }
expect(response.status).to eq(200)
parsed = JSON.parse(response.body)
expect(parsed["drafts"].length).to eq(0)
end
end end