Skip to content

Commit

Permalink
feat(matchers): be matcher handle simple constructor type check
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Oct 29, 2013
1 parent 75b4fba commit dcc42d0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/spectacular.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions specs/units/matchers.spec.coffee
Expand Up @@ -18,6 +18,18 @@ describe be, ->
it -> should be @subject
it -> shouldnt be {}

context 'when called with a function', ->
subject -> {}

it -> should be Object
it -> shouldnt be String

context 'and that the value is a function', ->
subject -> Object

it -> should be Object
it -> shouldnt be String

describe equal, ->

context 'with strings', ->
Expand Down
5 changes: 5 additions & 0 deletions src/matchers.coffee
Expand Up @@ -219,6 +219,11 @@ spectacular.matcher 'be', ->
@stateValue
when 'number', 'boolean'
actual?.valueOf() is @value
when 'function'
if typeof @actual is 'function'
actual is @value
else
actual?.constructor is @value
else
actual is @value

Expand Down

0 comments on commit dcc42d0

Please sign in to comment.