{"action":"created","issue":{"url":"https://api.github.com/repos/Chicago/RSocrata/issues/30","repository_url":"https://api.github.com/repos/Chicago/RSocrata","labels_url":"https://api.github.com/repos/Chicago/RSocrata/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/Chicago/RSocrata/issues/30/comments","events_url":"https://api.github.com/repos/Chicago/RSocrata/issues/30/events","html_url":"https://github.com/Chicago/RSocrata/issues/30","id":62739157,"number":30,"title":"Make RUnit tests work on complied project rather than global functions","user":{"login":"geneorama","id":1392068,"avatar_url":"https://avatars.githubusercontent.com/u/1392068?v=3","gravatar_id":"","url":"https://api.github.com/users/geneorama","html_url":"https://github.com/geneorama","followers_url":"https://api.github.com/users/geneorama/followers","following_url":"https://api.github.com/users/geneorama/following{/other_user}","gists_url":"https://api.github.com/users/geneorama/gists{/gist_id}","starred_url":"https://api.github.com/users/geneorama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geneorama/subscriptions","organizations_url":"https://api.github.com/users/geneorama/orgs","repos_url":"https://api.github.com/users/geneorama/repos","events_url":"https://api.github.com/users/geneorama/events{/privacy}","received_events_url":"https://api.github.com/users/geneorama/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"geneorama","id":1392068,"avatar_url":"https://avatars.githubusercontent.com/u/1392068?v=3","gravatar_id":"","url":"https://api.github.com/users/geneorama","html_url":"https://github.com/geneorama","followers_url":"https://api.github.com/users/geneorama/followers","following_url":"https://api.github.com/users/geneorama/following{/other_user}","gists_url":"https://api.github.com/users/geneorama/gists{/gist_id}","starred_url":"https://api.github.com/users/geneorama/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geneorama/subscriptions","organizations_url":"https://api.github.com/users/geneorama/orgs","repos_url":"https://api.github.com/users/geneorama/repos","events_url":"https://api.github.com/users/geneorama/events{/privacy}","received_events_url":"https://api.github.com/users/geneorama/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Chicago/RSocrata/milestones/1","html_url":"https://github.com/Chicago/RSocrata/milestones/sprint7","labels_url":"https://api.github.com/repos/Chicago/RSocrata/milestones/1/labels","id":1026222,"number":1,"title":"sprint7","description":"Start date: 3/17/15\r\nEnd date: 3/30/15\r\nDuration/biz days: TBD","creator":{"login":"SEV2014","id":9867351,"avatar_url":"https://avatars.githubusercontent.com/u/9867351?v=3","gravatar_id":"","url":"https://api.github.com/users/SEV2014","html_url":"https://github.com/SEV2014","followers_url":"https://api.github.com/users/SEV2014/followers","following_url":"https://api.github.com/users/SEV2014/following{/other_user}","gists_url":"https://api.github.com/users/SEV2014/gists{/gist_id}","starred_url":"https://api.github.com/users/SEV2014/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SEV2014/subscriptions","organizations_url":"https://api.github.com/users/SEV2014/orgs","repos_url":"https://api.github.com/users/SEV2014/repos","events_url":"https://api.github.com/users/SEV2014/events{/privacy}","received_events_url":"https://api.github.com/users/SEV2014/received_events","type":"User","site_admin":false},"open_issues":7,"closed_issues":1,"state":"closed","created_at":"2015-03-17T21:16:59Z","updated_at":"2016-03-08T23:20:55Z","due_on":"2015-03-30T05:00:00Z","closed_at":"2016-01-23T22:05:09Z"},"comments":1,"created_at":"2015-03-18T16:46:30Z","updated_at":"2016-05-16T18:04:04Z","closed_at":null,"body":"As I started working on a new branch, I noticed that the current test suite is testing functions that are loaded into the global namespace rather than the RSocrata namespace.  \r\n\r\nThis is a problem because it's possible to inadvertently test the wrong functions; you could have a function loaded into your global environment and not realize it, and think that your tests are passing, even though the package is not working.\r\n\r\nI noticed this because two functions, `validateURL` and `isFourByFour` are not exported in RSocrata.  These functions can be tested by using the `:::` to access these non-exported functions, e.g. `RSocrata:::validateURL`.\r\n\r\n@tomschenkjr I think it would be ideal to use the double colon `::` whenever we're testing RSocrata functions in order to ensure that we're always using functions from the package and not a local / global object; e.g. `RSocrata::read.socrata`.\r\n\r\nA nice side effect of following this testing methodology is that at the end of the process, you have a clean working environment, e.g.;\r\n\r\n```R\r\nR version 3.1.2 (2014-10-31) -- \"Pumpkin Helmet\"\r\nCopyright (C) 2014 The R Foundation for Statistical Computing\r\nPlatform: i386-w64-mingw32/i386 (32-bit)\r\n\r\nR is free software and comes with ABSOLUTELY NO WARRANTY.\r\nYou are welcome to redistribute it under certain conditions.\r\nType 'license()' or 'licence()' for distribution details.\r\n\r\nR is a collaborative project with many contributors.\r\nType 'contributors()' for more information and\r\n'citation()' on how to cite R or R packages in publications.\r\n\r\nType 'demo()' for some demos, 'help()' for on-line help, or\r\n'help.start()' for an HTML browser interface to help.\r\nType 'q()' to quit R.\r\n\r\n> library('RUnit')\r\n> printTextProtocol(runTestFile(\"R/tests/testRSocrata.R\"))\r\nLoading required package: httr\r\nLoading required package: jsonlite\r\n\r\nAttaching package: ‘jsonlite’\r\n\r\nThe following object is masked from ‘package:utils’:\r\n\r\n    View\r\n\r\nLoading required package: mime\r\n\r\n\r\nExecuting test function test.incorrectAPIQuery  ... 2015-03-18 11:44:09.003 getResponse: Error in httr GET: 400  https://soda.demo.socrata.com/resource/4334-bgaj.csv?%24app_token=ew2rEMuESuzWPqMkyPfOSGJgE\r\nError in getResponse(validUrl) : client error: (400) Bad Request\r\n done successfully.\r\n\r\n\r\n\r\nExecuting test function test.incorrectAPIQueryHumanReadable  ... 2015-03-18 11:44:09.738 getResponse: Error in httr GET: 400  https://soda.demo.socrata.com/resource/4334-bgaj.csv?%24app_token=ew2rEMuESuzWPqMkyPfOSGJgE\r\nError in getResponse(validUrl) : client error: (400) Bad Request\r\n done successfully.\r\n```\r\n[OUTPUT SUPPRESSED]\r\n\r\n```R\r\nRUNIT TEST PROTOCOL -- Wed Mar 18 11:44:17 2015 \r\n*********************************************** \r\nNumber of test functions: 23 \r\nNumber of errors: 0 \r\nNumber of failures: 0 \r\n\r\n \r\n1 Test Suite : \r\ntestRSocrata - 23 test functions, 0 errors, 0 failures\r\n\r\n\r\n\r\nDetails \r\n*************************** \r\nTest Suite: testRSocrata \r\nTest function regexp: ^test.+ \r\nTest file regexp: ^testRSocrata.R$ \r\nInvolved directory: \r\nR/tests \r\n--------------------------- \r\nTest file: R/tests/testRSocrata.R \r\ntest.incorrectAPIQuery: (3 checks) ... OK (1.52 seconds)\r\ntest.incorrectAPIQueryHumanReadable: (3 checks) ... OK (0.7 seconds)\r\ntest.isFourByFour: (5 checks) ... OK (0 seconds)\r\ntest.isFourByFourUrl: (4 checks) ... OK (0.01 seconds)\r\ntest.lsSocrata: (3 checks) ... OK (0.36 seconds)\r\ntest.lsSocrataInvalidURL: (1 checks) ... OK (0 seconds)\r\ntest.posixifyLong: (7 checks) ... OK (0 seconds)\r\ntest.posixifyShort: (7 checks) ... OK (0 seconds)\r\ntest.readAPIConflict: (3 checks) ... OK (0.5 seconds)\r\ntest.readAPIConflictHumanReadable: (3 checks) ... OK (0.47 seconds)\r\ntest.readPrivate: (1 checks) ... OK (0.17 seconds)\r\ntest.readSocrataCalendarDateLong: (7 checks) ... OK (0.78 seconds)\r\ntest.readSocrataCalendarDateShort: (7 checks) ... OK (0.46 seconds)\r\ntest.readSocrataCsv: (2 checks) ... OK (0.58 seconds)\r\ntest.readSocrataFormatNotSupported: (1 checks) ... OK (0.02 seconds)\r\ntest.readSocrataHumanReadable: (2 checks) ... OK (0.53 seconds)\r\ntest.readSocrataHumanReadableToken: (2 checks) ... OK (0.46 seconds)\r\ntest.readSocrataInvalidUrl: (1 checks) ... OK (0.01 seconds)\r\ntest.readSocrataJson: (2 checks) ... OK (0.84 seconds)\r\ntest.readSocrataNoScheme: (1 checks) ... OK (0 seconds)\r\ntest.readSocrataToken: (2 checks) ... OK (0.46 seconds)\r\ntest.readSoQL: (2 checks) ... OK (0.39 seconds)\r\ntest.readSoQLColumnNotFound: (1 checks) ... OK (0.14 seconds)\r\n> ls()\r\ncharacter(0)\r\n```\r\n\r\n "},"comment":{"url":"https://api.github.com/repos/Chicago/RSocrata/issues/comments/219498599","html_url":"https://github.com/Chicago/RSocrata/issues/30#issuecomment-219498599","issue_url":"https://api.github.com/repos/Chicago/RSocrata/issues/30","id":219498599,"user":{"login":"tomschenkjr","id":1639121,"avatar_url":"https://avatars.githubusercontent.com/u/1639121?v=3","gravatar_id":"","url":"https://api.github.com/users/tomschenkjr","html_url":"https://github.com/tomschenkjr","followers_url":"https://api.github.com/users/tomschenkjr/followers","following_url":"https://api.github.com/users/tomschenkjr/following{/other_user}","gists_url":"https://api.github.com/users/tomschenkjr/gists{/gist_id}","starred_url":"https://api.github.com/users/tomschenkjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomschenkjr/subscriptions","organizations_url":"https://api.github.com/users/tomschenkjr/orgs","repos_url":"https://api.github.com/users/tomschenkjr/repos","events_url":"https://api.github.com/users/tomschenkjr/events{/privacy}","received_events_url":"https://api.github.com/users/tomschenkjr/received_events","type":"User","site_admin":false},"created_at":"2016-05-16T18:04:04Z","updated_at":"2016-05-16T18:04:04Z","body":"@geneorama - since we've switched to `testthat`, is this still needed?"}}