-
-
Save joques/7e45d6884ce2d32e933d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zombie = require('zombie') | |
assert = require('assert') | |
browser = new zombie.Browser() | |
describe 'user authentication', -> | |
it 'should not accept an empty password', -> | |
browser.visit "https://localhost:3000/sessions/new", {debug: true}, (err, brs, status) -> | |
brs.fill "username", "fitz", -> | |
brs.fill "password", "", -> | |
brs.pressButton "Sign In", -> | |
assert.equal(brs.body.username, "fitz") | |
assert.equal(brs.body.password, "") | |
assert.equal(brs.location, "https://localhost:3000/sessions/new") | |
it "should not accept an empty username", -> | |
browser.visit "https://localhost:3000/sessions/new", {debug: true}, (err, brs, status) -> | |
brs.fill "username", "", -> | |
brs.fill "password", "fitzpass1", -> | |
brs.pressButton "Sign In", -> | |
assert.equal(brs.body.username, "") | |
assert.equal(brs.body.password, "fitzpass1") | |
assert.equal(brs.location, "https://localhost:3000/sessions/new") | |
it "should accept neither an empty username nor a password", -> | |
browser.visit "https://localhost:3000/sessions/new", (err, brs, status) -> | |
brs.fill "username", "", -> | |
brs.fill "password", "", -> | |
brs.pressButton "Sign In", -> | |
assert.equal(brs.body.username, "") | |
assert.equal(brs.body.password, "") | |
assert.equal(brs.location, "https://localhost:3000/sessions/new") | |
it "should take both a username and a password", -> | |
browser.visit "https://localhost:3000/sessions/new", {debug: true}, (err, brs, status) -> | |
brs.fill "username", "fitz", -> | |
brs.fill "password", "fitzpass2", -> | |
brs.pressButton "Sign In", -> | |
assert.equal(brs.body.username, "fitz") | |
assert.equal(brs.body.password, "fitzpass2") | |
assert.equal(brs.location, "https://localhost:3000/") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment