Skip to content

Commit

Permalink
start with test infrastruc.
Browse files Browse the repository at this point in the history
	modified:   R4CouchDB/R/cdbIni.R
	deleted:    R4CouchDB_0.3.2.tar.gz
	deleted:    R4CouchDB_0.3.tar.gz
	new file:   tests/load.r
	new file:   tests/testIni.r
  • Loading branch information
wactbprot committed Aug 1, 2014
1 parent 83c5027 commit 6b58f45
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R4CouchDB/R/cdbIni.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@

cdbIni <- function(serverName = "localhost",
port = "5984",
DBName = "",
prot = "http",
DBName = "",
uname = "",
pwd = "",
newDBName = "",
removeDBName = "",
id = "",
dataList = list(),
fileName = "",
design = "",
view = "",
list = "",
queryParam = "",
encSub = "?",
dataList = list(),
attachmentsWithPath = TRUE,
digits = 7){

Expand Down
Binary file removed R4CouchDB_0.3.2.tar.gz
Binary file not shown.
Binary file removed R4CouchDB_0.3.tar.gz
Binary file not shown.
10 changes: 10 additions & 0 deletions tests/load.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
srcPath <- "../R4CouchDB/R/"
fn <- list.files(srcPath, pattern="R$")

for (k in 1:length(fn)){
source(paste(srcPath, fn[k], sep=""))
}

library(RCurl)
library(RJSONIO)
library(testthat)
41 changes: 41 additions & 0 deletions tests/testIni.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
source("load.r")

context("Ini params of con list")

test_that("all defaults are present", {
cdb <- cdbIni()

expect_that(cdb$serverName, equals("localhost"))
expect_that(cdb$port , equals("5984"))
expect_that(cdb$prot , equals("http"))
expect_that(cdb$DBName , equals(""))
expect_that(cdb$uname , equals(""))
expect_that(cdb$pwd , equals(""))
expect_that(cdb$newDBName , equals(""))
expect_that(cdb$removeDBName , equals(""))
expect_that(cdb$id , equals(""))
expect_that(cdb$fileName , equals(""))
expect_that(cdb$design , equals(""))
expect_that(cdb$view , equals(""))
expect_that(cdb$list , equals(""))
expect_that(cdb$queryParam , equals(""))
expect_that(cdb$encSub , equals("?"))
expect_that(cdb$dataList , equals( list()))
expect_that(cdb$attachmentsWithPath , equals( TRUE))
expect_that(cdb$digits , equals(7))
})

test_that("all operational values are set", {
cdb <- cdbIni()

expect_that(cdb$localEnc , equals("UTF-8"))
expect_that(cdb$serverEnc , equals("UTF-8"))
expect_that(cdb$error , equals(""))
expect_that(cdb$res , equals(""))
})

test_that("Rcurl initializes as expected", {
cdb <- cdbIni()
expect_that(is.object(cdb$curl), equals(TRUE))
expect_that(class(cdb$curl)[1], equals("CURLHandle"))
})

0 comments on commit 6b58f45

Please sign in to comment.