Skip to content

Commit

Permalink
raw response test
Browse files Browse the repository at this point in the history
  • Loading branch information
Radagaisus committed Aug 26, 2014
1 parent ef1e32f commit 091ddfe
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lib/orpheus.coffee
Expand Up @@ -742,6 +742,8 @@ class OrpheusAPI
# Marks the query to return raw response
raw: ->
@flags.raw_response = true
# Return `this` for chaining
return this

#
err: (fn) ->
Expand Down
33 changes: 29 additions & 4 deletions test/orpheus.spec.coffee
Expand Up @@ -54,7 +54,7 @@ afterEach (done) ->


# Error Handling
# ---------------------------------------
# -----------------------------------------------------------------------------
describe 'Error Handling', ->
it 'Throws Error on Undefined Model Attributes', (done) ->
class User extends Orpheus
Expand All @@ -69,12 +69,37 @@ describe 'Error Handling', ->
catch e
return done()


# Fails if it gets here,
# Jasmine .toThrow() is shit.
# Fails if it gets here
expect('To Catch an Error').toBe true
done()


# Raw Responses
# --------------------------------------------------------------------------
describe 'Raw Responses', ->

it 'returns a raw response', (done) ->
class App extends Orpheus
constructor: ->
@zset 'leaderboard'

app = App.create()

app('test')
.leaderboard.add(50, 'radagaisus', 20, 'captain')
.exec ->
app('test')
.leaderboard.score('captain')
.leaderboard.revrank('captain')
.raw()
.exec (err, res) ->
expect(res[0]).toEqual '20'
expect(res[1]).toEqual 1
done()


# Schema Specs
# ------------------------------------------------------------------------------
describe 'Schema', ->

it 'can call the different models using the schema', (done) ->
Expand Down

0 comments on commit 091ddfe

Please sign in to comment.