Skip to content

Commit

Permalink
Merge pull request #142 from Chicago/issue141
Browse files Browse the repository at this point in the history
Hot patch to fix #141
  • Loading branch information
tomschenkjr authored Jun 23, 2017
2 parents f6dbf80 + 54101f6 commit 2c7d866
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Description: Provides easier interaction with
format and manages throttling by 'Socrata'.
Users can upload data to Socrata portals directly
from R.
Version: 1.7.2-12
Date: 2017-03-16
Version: 1.7.3-2
Date: 2017-06-22
Author: Hugh Devlin, Ph. D., Tom Schenk, Jr., and John Malc
Maintainer: "Tom Schenk Jr." <[email protected]>
Depends:
Expand Down
16 changes: 6 additions & 10 deletions tests/testthat/test-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ test_that("Fields with currency symbols remove the symbol and convert to money",
expect_equal("numeric", class(deniro), label="output of money fields")
})

test_that("converts money fields to numeric from Socrata", {
df <- read.socrata("https://data.cityofchicago.org/Administration-Finance/Current-Employee-Names-Salaries-and-Position-Title/xzkq-xp2w")
expect_equal("numeric", class(df$Annual.Salary), label="dollars")
expect_equal("numeric", class(df$Annual.Salary), label="output of money fields")
})

context("read Socrata")

test_that("read Socrata CSV as default", {
Expand Down Expand Up @@ -461,16 +467,6 @@ test_that("read Socrata JSON that requires a login", {
expect_equal(3, nrow(df), label="rows")
})

test_that("converts money fields to numeric", {
# Manual check
money <- "$15000"
numeric_money <- no_deniro(money)
expect_equal(15000, numeric_money, label="dollars")
# Use data from Socrata
df <- read.socrata("https://data.cityofchicago.org/Administration-Finance/Current-Employee-Names-Salaries-and-Position-Title/xzkq-xp2w")
expect_equal("numeric", class(df$Employee.Annual.Salary))
})

context("write Socrata datasets")

test_that("add a row to a dataset", {
Expand Down

0 comments on commit 2c7d866

Please sign in to comment.