Navigation Menu

Skip to content

Commit

Permalink
Check field existence before updating default search field
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 27, 2012
1 parent f2d03b5 commit bc645ef
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion bin/gcs-configure-default-search-field
Expand Up @@ -18,7 +18,7 @@ commandLine.assertHaveDomainName();
commandLine.assertDomainExists();

var field = commandLine.domain.getIndexField(commandLine.options.name);
if (field) {
if (field && field.exists()) {
console.log('Setting "%s" as the default search field of "%s"...',
field.name,
commandLine.domain.name);
Expand Down
2 changes: 1 addition & 1 deletion test/gcs-commands.test.js
Expand Up @@ -747,7 +747,7 @@ suite('gcs-configure-default-search-field', function() {
assert.deepEqual({ code: result.code,
message: result.output.stdout },
{ code: 1,
message: '"name" as not a field of "companies".\n' },
message: '"address" is not a field of "companies".\n' },
result.output.stderr);
assert.equal(domain.defaultSearchField.name, 'name');
done();
Expand Down

0 comments on commit bc645ef

Please sign in to comment.