Permalink
Browse files

Ignore null valued arguments

  • Loading branch information...
darashi committed Jul 31, 2012
1 parent 138bd7e commit 321917281545aa1fc2854a6f44490935a6583aea
Showing with 13 additions and 4 deletions.
  1. +4 −2 lib/nroonga.js
  2. +3 −2 src/nroonga.coffee
  3. +6 −0 test/database.test.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -5,8 +5,9 @@ optionsToCommandString = (command, options) ->
args = [command]
if options?
for key, value of options
- args.push '--' + key
- args.push JSON.stringify(value)
+ if value?
+ args.push '--' + key
+ args.push JSON.stringify(value)
args.join(' ')
overrideOutputType = (optionsGiven, type) ->
@@ -117,6 +117,12 @@ describe 'database with data stored', ->
matched[0][0][0].should.equal(3)
done()
+ it 'should select records ignoring the null valued option', (done) ->
+ withTestDatabase (db) ->
+ matched = db.commandSync('select', table: 'Site', query: null)
+ matched[0][0][0].should.equal(3)
+ done()
+
it 'should search by query', (done) ->
withTestDatabase (db) ->
matched = db.commandSync 'select',

0 comments on commit 3219172

Please sign in to comment.