Skip to content

Commit

Permalink
*sigh* forgot the -a
Browse files Browse the repository at this point in the history
  • Loading branch information
Maverick committed May 5, 2010
1 parent 33c75da commit 3b3883e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,7 +1,9 @@
Makefile
META.yml
blib
pm_to_blib
cover_db
*.tar.gz
*.bak
*.old
inc
9 changes: 9 additions & 0 deletions Changes
@@ -1,3 +1,12 @@
0.07 - 2010-05-05
=================
Applied patch from Jon Allen to fix json encoding bug in fixViewArgs
in CouchDB::Client::DB.

http://github.com/jonallen/couchdb-client/commit/91172ac735c34d4d974788615227088d56db4812

Added tests for fixViewArgs.

0.06 - 2010-03-21
=================
Added Changes file
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.SKIP
Expand Up @@ -18,6 +18,7 @@
^log$
^blibdirs$
\.tar\.gz$
^.gitignore$/

cover_db
CouchDB-Deploy.tmproj
Expand Down
31 changes: 30 additions & 1 deletion t/12-small-things.t
Expand Up @@ -15,7 +15,7 @@ use LWP::UserAgent;

my $cdb = CouchDB::Client->new( uri => $ENV{COUCHDB_CLIENT_URI} || 'http://localhost:5984/' );
if($cdb->testConnection) {
plan tests => 10;
plan tests => 14;
}
else {
plan skip_all => 'Could not connect to CouchDB, skipping.';
Expand All @@ -29,6 +29,35 @@ EOMSG
my $C = $cdb;
my $DB = $C->newDB('blah');

### LOW LEVEL FUNCTIONS
{
my %encoded = $DB->fixViewArgs(
endkey => 'foo',
descending => 1,
update => 1,
keeps => 'me correctly'
);

is_deeply(\%encoded, {
endkey => '"foo"',
descending => 'true',
keeps => 'me correctly'
}, "fixViewArgs works as expected");

%encoded = $DB->fixViewArgs(descending => 0, update => 0);
is_deeply(\%encoded, { update => 'false' }, "fixViewArgs works as expected 2");

%encoded = $DB->fixViewArgs(
key => [ 'one', 'two' ],
startkey => { 'key' => 'value' },
);

# I've made the regexps as forgiving as a I can to account for possible
# differences in the various json encoders.
ok($encoded{key} =~ /^\s*\[\s*['"]one['"]\s*,\s*['"]two['"]\s*\]\s*$/, "Array encode works");
ok($encoded{startkey} =~ /^\s*\{['"]?key['"]?\s*:\s*['"]value['"]\s*}\s*$/, "Hash encode works");
}

### DESIGN DOC
{
my $dd;
Expand Down

0 comments on commit 3b3883e

Please sign in to comment.