1
0
mirror of https://github.com/danog/gift.git synced 2024-11-26 20:04:47 +01:00
gift/test/actor.test.coffee
feugy 1ed508199f - Repo.commit: send stdout/stderr to callback lile other methods
- Tests: use a working 'remotes' fixture. Old one was broken.
- Tests: use chai instead of should: same API, but work properly on Date:
  https://github.com/visionmedia/should.js/pull/56
- Tests: use rimraf instead of executing "rm -rf": allow to work on windows
- Tests: configure mocha to execute coffee-script with --compilers option
2012-09-14 09:12:26 +02:00

44 lines
1.2 KiB
CoffeeScript

should = require('chai').should()
Actor = require '../src/actor'
describe "Actor", ->
describe ".constructor", ->
actor = new Actor "bob", "bob@example.com"
it "assigns @name", ->
actor.name.should.eql "bob"
it "assigns @email", ->
actor.email.should.eql "bob@example.com"
describe "#toString", ->
actor = new Actor "bob", "bob@example.com"
it "is a string representation of the actor", ->
actor.toString().should.eql "bob <bob@example.com>"
describe "#hash", ->
actor = new Actor "bob", "bob@example.com"
it "is the md5 hash of the email", ->
actor.hash.should.eql "4b9bb80620f03eb3719e0a061c14283d"
describe ".from_string", ->
describe "with a name and email", ->
actor = Actor.from_string "bob <bob@example.com>"
it "parses the name", ->
actor.name.should.eql "bob"
it "parses the email", ->
actor.email.should.eql "bob@example.com"
describe "with only a name", ->
actor = Actor.from_string "bob"
it "parses the name", ->
actor.name.should.eql "bob"
it "does not parse the email", ->
should.not.exist actor.email