Browse files

Merge pull request #1 from ezkl/feature/add-tests

Test Coverage
  • Loading branch information...
2 parents 1718d04 + fb51c22 commit 76a362e032328d31cde8b3047c8a56168f8746f2 @apohllo committed Mar 26, 2012
View
1 .gitignore
@@ -2,3 +2,4 @@ pkg/*
*.gem
.bundle
.*.sw?
+Gemfile.lock
View
2 .rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
View
12 Gemfile
@@ -1,4 +1,14 @@
-source :gemcutter
+source :rubygems
# Specify your gem's dependencies in ckan.gemspec
gemspec
+
+group :development do
+ gem 'guard-rspec', :require => false
+ gem 'growl', :require => false
+end
+
+group :development, :test do
+ gem 'pry', :require => false
+end
+
View
15 Gemfile.lock
@@ -1,15 +0,0 @@
-PATH
- remote: .
- specs:
- ckan (0.0.1)
-
-GEM
- remote: http://rubygems.org/
- specs:
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- bundler (>= 1.0.0)
- ckan!
View
6 Guardfile
@@ -0,0 +1,6 @@
+guard 'rspec', :version => 2, :cli => "--format documentation" do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
View
4 Rakefile
@@ -1,2 +1,6 @@
require 'bundler'
Bundler::GemHelper.install_tasks
+
+require 'rspec/core/rake_task'
+RSpec::Core::RakeTask.new(:spec)
+task :default => :spec
View
3 ckan.gemspec
@@ -15,6 +15,9 @@ Gem::Specification.new do |s|
s.rubyforge_project = "ckan"
s.add_development_dependency "bundler", ">= 1.0.0"
+ s.add_development_dependency "rspec", "~> 2.9.0"
+ s.add_development_dependency "vcr", "~> 2.0.0"
+ s.add_development_dependency "webmock", "~> 1.8.4"
s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
View
113 spec/cassettes/colournames_package.yml
@@ -0,0 +1,113 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://ckan.net/api/1/rest/package/colournames
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 301
+ message: Moved Permanently
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:18:20 GMT
+ Content-Type:
+ - text/html
+ Content-Length:
+ - '185'
+ Location:
+ - http://thedatahub.org/api/1/rest/package/colournames
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
+ bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx/0.7.65</center>\r\n</body>\r\n</html>\r\n"
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:18:20 GMT
+- request:
+ method: get
+ uri: http://thedatahub.org/api/1/rest/package/colournames
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:18:22 GMT
+ Content-Type:
+ - application/json;charset=utf-8
+ Pragma:
+ - no-cache
+ Cache-Control:
+ - no-cache
+ Access-Control-Allow-Origin:
+ - ! '*'
+ Access-Control-Allow-Methods:
+ - POST, PUT, GET, OPTIONS
+ Access-Control-Allow-Headers:
+ - X-CKAN-API-KEY
+ Set-Cookie:
+ - ckan_lang=en; Path=/
+ Content-Length:
+ - '1933'
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '{"license_title": "License Not Specified", "maintainer": null, "maintainer_email":
+ null, "id": "53587fae-fb5f-46e5-ae55-14f9951d0808", "metadata_created": "2009-12-04T21:34:40.311723",
+ "relationships": [], "license": "License Not Specified", "metadata_modified":
+ "2009-12-28T22:27:30.559623", "author": "Dolores Labs", "author_email": "info@doloreslabs.com",
+ "download_url": "http://assets.doloreslabs.com/jobs/colors/doloreslabs-color-names-v1.zip",
+ "state": "active", "version": "1", "license_id": "notspecified", "type": null,
+ "resources": [{"mimetype": null, "resource_group_id": "ac52491c-3d91-e898-e03d-83c444312a21",
+ "hash": null, "description": "", "format": "", "url": "http://assets.doloreslabs.com/jobs/colors/doloreslabs-color-names-v1.zip",
+ "cache_url": null, "webstore_url": null, "cache_last_updated": null, "package_id":
+ "53587fae-fb5f-46e5-ae55-14f9951d0808", "mimetype_inner": null, "webstore_last_updated":
+ null, "last_modified": null, "position": 0, "size": null, "id": "a83dbe22-c0cd-4a50-a4d2-7300a476028c",
+ "resource_type": null, "name": null}], "tags": ["aesthetics", "colour", "dataset",
+ "perception"], "groups": ["art"], "name": "colournames", "isopen": false,
+ "notes_rendered": "<p>Comma-Separated Value dataset of 10,000 colours and
+ the labels applied to them by Amazon Mechanical Turk clickworkers.\n</p>\n<p>Archive
+ contains the dataset and useful accompanying software.\n</p>", "url": "http://blog.doloreslabs.com/2008/03/our-color-names-data-set-is-online/",
+ "ckan_url": "http://thedatahub.org/dataset/colournames", "notes": "Comma-Separated
+ Value dataset of 10,000 colours and the labels applied to them by Amazon Mechanical
+ Turk clickworkers.\r\n\r\nArchive contains the dataset and useful accompanying
+ software.", "title": "Dolores Labs Blog \u00bb Our color names data set is
+ online", "ratings_average": 5.0, "extras": {}, "ratings_count": 2, "revision_id":
+ "e6a6eb1b-8239-46bf-92be-a44889ec58f7"}'
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:18:22 GMT
+recorded_with: VCR 2.0.0
View
110 spec/cassettes/find_all_group_packages.yml
@@ -0,0 +1,110 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://ckan.net/api/1/rest/group/art
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 301
+ message: Moved Permanently
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:08:52 GMT
+ Content-Type:
+ - text/html
+ Content-Length:
+ - '185'
+ Location:
+ - http://thedatahub.org/api/1/rest/group/art
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
+ bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx/0.7.65</center>\r\n</body>\r\n</html>\r\n"
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:08:52 GMT
+- request:
+ method: get
+ uri: http://thedatahub.org/api/1/rest/group/art
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:08:53 GMT
+ Content-Type:
+ - application/json;charset=utf-8
+ Pragma:
+ - no-cache
+ Cache-Control:
+ - no-cache
+ Access-Control-Allow-Origin:
+ - ! '*'
+ Access-Control-Allow-Methods:
+ - POST, PUT, GET, OPTIONS
+ Access-Control-Allow-Headers:
+ - X-CKAN-API-KEY
+ Set-Cookie:
+ - ckan_lang=en; Path=/
+ Content-Length:
+ - '1738'
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '{"users": [], "display_name": "Art", "description": "For data regarding
+ artworks, collections, galleries or museums, state funding or involvement
+ in the arts, art history, and aesthetics.\r\n\r\nThere''s been a lot of activity
+ on the art open data front recently:\r\n\r\n* [Art Open Data - Datasets Update](http://robmyers.org/2011/10/16/open-art-data---datasets-update/)\r\n\r\nHere
+ are some examples of the kinds of things you can do with art open data:\r\n\r\n*
+ [A scatter plot of paintings](http://robmyers.org/2011/09/18/imageplot-and-properties-plotr/)\r\n\r\n*
+ [Statistical analysis of art historical texts](http://robmyers.org/2010/12/23/exploring-art-data-8/)\r\n\r\n*
+ [More statistical analysis of art historical texts](http://robmyers.org/weblog/2010/12/exploring-art-data-9.html)\r\n\r\n*
+ [Analysis of museum attendance](http://robmyers.org/weblog/2010/11/exploring-art-data-5.html)\r\n\r\n*
+ [Analysis of state funding for the arts](http://robmyers.org/2010/11/21/exploring-art-data-3/)\r\n",
+ "created": "2010-02-23T19:30:51.840775", "title": "Art", "approval_status":
+ "approved", "state": "active", "extras": {}, "groups": [], "revision_id":
+ "8983d0e5-2acf-4252-abad-f92429a13830", "packages": ["color-inspiration",
+ "colournames", "colr-org", "europeana-lod", "flickr-thecommons", "freebase-visual-art",
+ "grants-for-the-arts-awards-arts-council-england", "jisc-openart", "national-indicators-9-10-11-baselines",
+ "noun-project", "powerhouse-museum-collection", "seattle-public-art", "technologies-of-enchantment",
+ "uk-national-gallery", "ukgac", "vads", "vanda-api", "wikimedia-commons-paintings",
+ "wikimedia_commons", "yorck-project"], "type": "group", "id": "2c4629ee-8fbe-4452-9b33-dc094ac80301",
+ "tags": [], "name": "art"}'
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:08:53 GMT
+recorded_with: VCR 2.0.0
View
108 spec/cassettes/find_all_groups.yml
@@ -0,0 +1,108 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://ckan.net/api/1/rest/group
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 301
+ message: Moved Permanently
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:03:14 GMT
+ Content-Type:
+ - text/html
+ Content-Length:
+ - '185'
+ Location:
+ - http://thedatahub.org/api/1/rest/group
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
+ bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx/0.7.65</center>\r\n</body>\r\n</html>\r\n"
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:03:14 GMT
+- request:
+ method: get
+ uri: http://thedatahub.org/api/1/rest/group
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:03:15 GMT
+ Content-Type:
+ - application/json;charset=utf-8
+ Pragma:
+ - no-cache
+ Cache-Control:
+ - no-cache
+ Access-Control-Allow-Origin:
+ - ! '*'
+ Access-Control-Allow-Methods:
+ - POST, PUT, GET, OPTIONS
+ Access-Control-Allow-Headers:
+ - X-CKAN-API-KEY
+ Set-Cookie:
+ - ckan_lang=en; Path=/
+ Content-Length:
+ - '1326'
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '["access-to-medicines", "archaeology", "argentina-salud", "art",
+ "belarus_open_data", "bibliographic", "bibsoup", "bolivia", "bosnia-herzegovina",
+ "brazil", "canadagov", "carbon-emissions", "chemistry", "civil-society", "climatedata",
+ "cmap", "country-be", "country-ca", "country-gr", "country-hu", "country-lt",
+ "country-si", "curation_testing", "data_canada", "datafaqs", "datagovau_admin",
+ "datagovau_administrators", "datalocale", "dictionaries", "economics", "emergencies",
+ "energy-data", "eutransparency", "fso", "funded-research-projects", "geo_ottawa",
+ "geodata", "hclsig_lodd", "history", "international-development", "ireland",
+ "italy", "latc", "learning", "linguistics", "linked_statistics", "lld", "lod",
+ "lodcloud", "logdcloud", "longtermpaydayloans", "mkedata", "mobile-health",
+ "moldova", "mpt-unofficial", "nederland", "occupy", "odszkodowania", "oers",
+ "ontologies", "open-data-day", "open-economics", "opendatamx", "openspending",
+ "opentox-ambit", "pd-metadata", "product-scheme-classifications", "publicdomain",
+ "railways", "religion", "rides", "science", "serbia", "software-industry-in-germany",
+ "spain", "steria", "test", "theatre", "toxcast", "tunisia", "ukdiscovery",
+ "ukgov", "undp-europe-and-cis", "university-of-oxford", "uscfacade", "visualizing-org",
+ "wdmmg", "wikimedia", "workrooths", "z-group"]'
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:03:15 GMT
+recorded_with: VCR 2.0.0
View
1,108 spec/cassettes/find_all_packages.yml
1,108 additions, 0 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
308 spec/cassettes/find_packages_tagged_lod_and_government.yml
@@ -0,0 +1,308 @@
+---
+http_interactions:
+- request:
+ method: get
+ uri: http://ckan.net/api/1/search/package?tags=government
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 301
+ message: Moved Permanently
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:40:43 GMT
+ Content-Type:
+ - text/html
+ Content-Length:
+ - '185'
+ Location:
+ - http://thedatahub.org/api/1/search/package?tags=lod&tags=government
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
+ bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx/0.7.65</center>\r\n</body>\r\n</html>\r\n"
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:40:43 GMT
+- request:
+ method: get
+ uri: http://thedatahub.org/api/1/search/package?tags=government
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:40:44 GMT
+ Content-Type:
+ - application/json;charset=utf-8
+ Pragma:
+ - no-cache
+ Cache-Control:
+ - no-cache
+ Access-Control-Allow-Origin:
+ - ! '*'
+ Access-Control-Allow-Methods:
+ - POST, PUT, GET, OPTIONS
+ Access-Control-Allow-Headers:
+ - X-CKAN-API-KEY
+ Set-Cookie:
+ - ckan_lang=en; Path=/
+ Content-Length:
+ - '271'
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '{"count": 517, "results": ["2000-us-census-rdf", "addgene", "aemet",
+ "agrovoc-skos", "allen-brain-atlas", "allie-abbreviation-and-long-form-database-in-life-science",
+ "amsterdam-museum-as-edm-lod", "animal-diversity-web", "archiveshub-linkeddata",
+ "austrian_ski_racers"]}'
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:40:44 GMT
+- request:
+ method: get
+ uri: http://ckan.net/api/1/search/package?limit=527&offset=10&tags=government
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 301
+ message: Moved Permanently
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:40:44 GMT
+ Content-Type:
+ - text/html
+ Content-Length:
+ - '185'
+ Location:
+ - http://thedatahub.org/api/1/search/package?tags=lod&tags=government&offset=10&limit=527
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! "<html>\r\n<head><title>301 Moved Permanently</title></head>\r\n<body
+ bgcolor=\"white\">\r\n<center><h1>301 Moved Permanently</h1></center>\r\n<hr><center>nginx/0.7.65</center>\r\n</body>\r\n</html>\r\n"
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:40:44 GMT
+- request:
+ method: get
+ uri: http://thedatahub.org/api/1/search/package?limit=527&offset=10&tags=government
+ body:
+ encoding: US-ASCII
+ string: ''
+ headers:
+ Accept:
+ - ! '*/*'
+ User-Agent:
+ - Ruby
+ response:
+ status:
+ code: 200
+ message: OK
+ headers:
+ Server:
+ - nginx/0.7.65
+ Date:
+ - Thu, 22 Mar 2012 04:40:45 GMT
+ Content-Type:
+ - application/json;charset=utf-8
+ Pragma:
+ - no-cache
+ Cache-Control:
+ - no-cache
+ Access-Control-Allow-Origin:
+ - ! '*'
+ Access-Control-Allow-Methods:
+ - POST, PUT, GET, OPTIONS
+ Access-Control-Allow-Headers:
+ - X-CKAN-API-KEY
+ Set-Cookie:
+ - ckan_lang=en; Path=/
+ Content-Length:
+ - '10623'
+ X-Cache:
+ - MISS from localhost
+ X-Cache-Lookup:
+ - MISS from localhost:80
+ Via:
+ - 1.0 localhost (squid/3.0.STABLE19)
+ Connection:
+ - close
+ body:
+ encoding: US-ASCII
+ string: ! '{"count": 517, "results": ["b3kat", "bams", "bbc-music", "bbc-programmes",
+ "bbc-wildlife-finder", "bbop", "bbop-selected", "beneficiaries-of-the-european-commission",
+ "berlin-offener-haushalt", "bibbase", "bible-ontology", "billion_triples_challenge_dataset2008",
+ "billion_triples_challenge_dataset_2010", "bio2rdf-affymetrix", "bio2rdf-biocyc",
+ "bio2rdf-cas", "bio2rdf-chebi", "bio2rdf-genbank", "bio2rdf-geneid", "bio2rdf-go",
+ "bio2rdf-hgnc", "bio2rdf-homologene", "bio2rdf-interpro", "bio2rdf-kegg-compound",
+ "bio2rdf-kegg-drug", "bio2rdf-kegg-enzyme", "bio2rdf-kegg-glycan", "bio2rdf-kegg-pathway",
+ "bio2rdf-kegg-reaction", "bio2rdf-mgi", "bio2rdf-obo", "bio2rdf-omim", "bio2rdf-pdb",
+ "bio2rdf-pfam", "bio2rdf-prodom", "bio2rdf-prosite", "bio2rdf-pubchem", "bio2rdf-pubmed",
+ "bio2rdf-reactome", "bio2rdf-sgd", "bio2rdf-uniprot", "bio2rdf-uniprot-taxonomy",
+ "bio2rdf-uniprot-uniparc", "bio2rdf-uniprot-unipathway", "bio2rdf-unists",
+ "biographical-directory-of-the-united-states-congress", "bitzi", "bluk-bnb",
+ "brazilian-politicians", "bricklink", "british-museum-collection", "bund-offener-haushalt",
+ "business-data-gov-uk", "calames", "cap-italy-rdf", "chef_moz", "chem2bio2rdf",
+ "chempedia-rdf", "chronicling-america", "clean-energy-data-reegle", "coins-openuplabs",
+ "combined-nomenclature-2012", "core", "cornetto", "cpa-2008", "cpc-2008",
+ "cpv-2003", "cpv-2008", "ctic-public-dataset", "culturalinkeddata", "data-bnf-fr",
+ "data-cnr-it", "data-gov-ie", "data-gov-uk-time-intervals", "data-incubator-climb",
+ "data-incubator-discogs", "data-incubator-metoffice", "data-incubator-moseley",
+ "data-incubator-musicbrainz", "data-incubator-nasa", "data-incubator-our-airports",
+ "data-incubator-pokedex", "data-incubator-smcjournals", "data-open-ac-uk",
+ "datagov-catalog", "datos-bcn-cl", "datos-bne-es", "dbpedia", "dbpedia-el",
+ "dbpedia-lite", "dbpedia-live", "dbpedia-pt", "dbpedia-spotlight", "dbtropes",
+ "dbtune", "dbtune-artists-last-fm", "dbtune-audioscrobbler", "dbtune-classical",
+ "dbtune-john-peel-sessions", "dbtune-magnatune", "dbtune-musicbrainz", "dbtune-myspace",
+ "dclg-openuplabs", "dcs-sheffield", "deutsche-biographie", "deutsche-nationalbibliografie-dnb",
+ "dewey_decimal_classification", "diavgeia", "didactalia", "dmoz_rdf_dump",
+ "dnb-gemeinsame-normdatei", "doap_store", "doi", "dutch-national-regulations-metalex",
+ "ecco-tcp-linked-data", "ecs", "education-data-gov-uk", "education-openuplabs",
+ "educationalprograms_sisvu", "eea", "eea-rod", "enakting-co2emission", "enakting-crime",
+ "enakting-energy", "enakting-mortality", "enakting-nhs", "enakting-population",
+ "english-index-of-multiple-deprivation-ranking-2010", "english-index-of-multiple-deprivation-score-2010",
+ "english-indices-of-multiple-deprivation", "englishheritage_places", "enipedia",
+ "entrez_gene", "entrez_gene_extract", "environment-agency-bathing-water-quality",
+ "environment-data-gov-uk", "environmental-applications-reference-thesaurus",
+ "esd-standards", "eu-institutions", "eu-parliament-media", "eu-who-is-who",
+ "eunis", "eur-lex-rdf", "european-central-bank-statistics-linked-data", "europeana-lod",
+ "eurostat-rdf", "euskadi-farmacias", "eutc-productions", "event-media", "facebook-lids",
+ "fanhubz", "fao-geopolitical-ontology", "farmbio-chembl", "farmers-markets-geographic-data-united-states",
+ "federal-economic-rdf", "feedwrapper-lids", "finnish-municipalities", "fishes-of-texas",
+ "flickr-wrappr", "fly-ted", "flyatlas", "foodista", "freebase", "freebase_rdf_store",
+ "fu-berlin-cordis", "fu-berlin-dailymed", "fu-berlin-dblp", "fu-berlin-diseasome",
+ "fu-berlin-drugbank", "fu-berlin-euraxess", "fu-berlin-eures", "fu-berlin-eurostat",
+ "fu-berlin-medicare", "fu-berlin-project-gutenberg", "fu-berlin-sider", "fu-berlin-stitch",
+ "galen_from_co-odeorg", "gemeenschappelijke-thesaurus-audiovisuele-archieven",
+ "gemet", "geographic-openuplabs", "geolinkeddata", "geological-survey-of-austria-thesaurus",
+ "geonames-semantic-web", "geospecies", "geowordnet", "gesis-thesoz", "glastonbury-2011",
+ "global-hunger-index-2011", "gnoss", "go_annotations_from_ncbi_and_ebi", "googleart-wrapper",
+ "government-web-integration-for-linked-data", "govtrack", "greater-manchester-bus-timetable-linked-data",
+ "grrp", "grrt", "hbz_unioncatalog", "hellenic-fire-brigade", "hellenic-police",
+ "homologene", "hungarian-national-library-catalog", "idreffr", "insemtives",
+ "integrated-human-geography-service-for-lod", "intervalue", "iptc-newscodes",
+ "iserve", "isic-v4", "iso-3166-2-data", "istat-immigration", "italian-public-schools-linkedopendata-it",
+ "iucr-acta-cryst-e", "j-ucs-journal-of-universal-computer-science", "jamendo-dbtune",
+ "japan-radioactivity-stat", "jisc-cetis-directory", "jiscopenbib-bl_bnb-1",
+ "jita", "john-goodwins-family-tree", "kaken", "kasabi-eumida", "kasabi-eurobarometer-standard",
+ "kasabi-european-election-results", "klappstuhlclub", "knoesis-linked-sensor-data",
+ "l3s-dblp", "lcsh", "lcsubjects", "legislation-openuplabs", "lexvo", "libris",
+ "lichfield-spending", "lingvoj", "linked-crunchbase", "linked-edgar", "linked-eurostat",
+ "linked-life-data", "linked-nuts", "linked-open-camera", "linked-open-commerce",
+ "linked-open-data-of-ecology", "linked-open-numbers", "linked-open-piracy",
+ "linked-open-senate", "linked-open-vocabularies-lov", "linked-periodicals",
+ "linked-recipes", "linked-scotland", "linked-structured-product-labels", "linked-user-feedback",
+ "linkedct", "linkedgeodata", "linkedgeodata-aerodromes", "linkedlccn", "linkedmarkmail",
+ "linkedmdb", "linking-open-drug-data", "lista-encabezamientos-materia", "lobi",
+ "lobid-organisations", "lobid-resources", "loc", "loius", "london-gazette",
+ "los_metar", "lotico", "lower-layer-super-output-areas", "manchester-university-reading-lists",
+ "marc-codes", "massobservationarchivecatalogue", "medline", "meducator", "mesh-finnish",
+ "mesh_headings", "mesh_ipsv_skos_rdf", "mesh_pairs", "mesh_titles", "morelab",
+ "munich-offener-haushalt", "museums-in-italy", "my-experiment", "naics-2007",
+ "naics-2012", "nalt", "national-diet-library-authorities", "near", "neel",
+ "neurocommons_text_mining_pilot", "newsweek", "nhs-jargon", "nlm_2007_mesh",
+ "nomenclator-asturias-2010", "normesh", "nottingham-trent-university-resource-lists",
+ "ntnusc", "nuts-geovocab", "nvd", "nytimes-linked-open-data", "oanetzwerk",
+ "oceandrilling-codices", "oceandrilling-dbseabed", "oceandrilling-forams",
+ "oceandrilling-janus", "oceandrilling-janusamp", "oceandrilling-ldeo", "oclc-fast",
+ "odc", "odc-imd-environment-score", "odc-imd-rank-2007", "odc-lsoa", "odc-population-2005",
+ "offener-haushalt", "ogolod", "ontos-news-portal", "open-data-euskadi", "open-data-thesaurus",
+ "open-election-data-project", "open-energy-info-wiki", "open_directory", "opencalais",
+ "opencorporates", "opencyc", "openlibrary", "openlink-lod-cache", "openlylocal",
+ "openuplabs", "ordnance-survey-linked-data", "pali-english-lexicon", "patents-data-gov-uk",
+ "pleiades", "pokepedia-fr", "prefix-cc", "prelinger_archives", "printed-book-auction-catalogues",
+ "productdb", "productontology", "pscs-catalogue", "psh-subject-headings",
+ "public-record-office-victoria-semantic-wiki", "qualitywebdata-org", "quotations_book",
+ "radatana", "rdf-book-mashup", "rdfize-lastfm", "rdfohloh", "rechtspraak",
+ "reference-data-gov-uk", "renewable_energy_generators", "research-data-gov-uk",
+ "revyu", "riese", "rkb-explorer-acm", "rkb-explorer-budapest", "rkb-explorer-citeseer",
+ "rkb-explorer-cordis", "rkb-explorer-courseware", "rkb-explorer-crime", "rkb-explorer-crm",
+ "rkb-explorer-curriculum", "rkb-explorer-darmstadt", "rkb-explorer-dblp",
+ "rkb-explorer-deepblue", "rkb-explorer-deploy", "rkb-explorer-digitaleconomy",
+ "rkb-explorer-dotac", "rkb-explorer-ecs", "rkb-explorer-enaktingpsi", "rkb-explorer-eprints",
+ "rkb-explorer-epsrc", "rkb-explorer-era", "rkb-explorer-eurecom", "rkb-explorer-ft",
+ "rkb-explorer-fun", "rkb-explorer-gdlc", "rkb-explorer-ibm", "rkb-explorer-ieee",
+ "rkb-explorer-irit", "rkb-explorer-italy", "rkb-explorer-jisc", "rkb-explorer-kaunas",
+ "rkb-explorer-kisti", "rkb-explorer-laas", "rkb-explorer-lisbon", "rkb-explorer-newcastle",
+ "rkb-explorer-notube", "rkb-explorer-nsf", "rkb-explorer-oai", "rkb-explorer-opencyc",
+ "rkb-explorer-os", "rkb-explorer-photos", "rkb-explorer-pisa", "rkb-explorer-rae2001",
+ "rkb-explorer-resex", "rkb-explorer-risks", "rkb-explorer-roma", "rkb-explorer-roni",
+ "rkb-explorer-southampton", "rkb-explorer-ulm", "rkb-explorer-unlocode", "rkb-explorer-webconf",
+ "rkb-explorer-webscience", "rkb-explorer-wiki", "rkb-explorer-wordnet", "rkb_explorer_data",
+ "rpm_find", "rxnorm", "sadi-semantic-web-services-framework-registry", "sameas-org",
+ "sandrart-net", "sanskrit-english-lexicon", "santillana_guide_dataset", "schemapedia",
+ "scholarometer", "science_commons", "scotland-pupil-numbers-and-exam-results-2008",
+ "scotland-statistical-geography", "sears", "sec-rdfabout", "secold", "semantic-library",
+ "semantic-profiling-network", "semantic-universe", "semantic-web-dog-food",
+ "semantic-xbrl", "semantic_bible", "semantictweet", "semanticweb-org", "semsol-crunchbase",
+ "simile_data_collection", "sitc-v4", "slideshare2rdf", "smartlink", "socialsemweb-thesaurus",
+ "southampton-ac-uk-apps", "southampton-ecs-eprints", "spqr", "st-andrews-resource-lists",
+ "staff-organograms-and-pay-scottish-government", "staff-organograms-and-pay-thurrock-thames-gateway-development-corporation",
+ "statistics-data-gov-uk", "steak", "stitch-rameau", "stw-thesaurus-for-economics",
+ "sudocfr", "surge-radio", "swedish-open-cultural-heritage", "sweto-dblp",
+ "sztaki-lod", "t4gm-info", "tags2con-delicious", "talis-openlibrary", "taxonconcept",
+ "tcga", "tcmgenedit_dataset", "tekord", "telegraphis", "temple-ov-thee-lemur-datasets",
+ "testee", "texai_lexicon", "the-drug-interaction-knowledge-base", "the-view-from",
+ "thesaurus-datenwissen", "thesaurus-w", "thesesfr", "traffic-scotland", "transport-data-gov-uk",
+ "transport-openuplabs", "twarql", "twc-data-gov", "twc-logd", "twitter-lids",
+ "ub-mannheim-linked-data", "uberblic", "uk-legislation-api", "uk-postcodes",
+ "umbel", "umthes", "un-hazardous-numbers", "uniprot", "uniref", "university-plymouth-reading-lists",
+ "university-sussex-reading-lists", "uriburner", "us_census_data", "viaf",
+ "vivo", "vivo-cornell-university", "vivo-indiana-university", "vivo-university-of-florida",
+ "vu-wordnet", "vulnerapedia", "w3c-provenance-incubator-group-vocabulary-mappings",
+ "w3c-wordnet", "webnmasunotraveler", "wikipedia3", "world-bank-linked-data",
+ "world-factbook-fu-berlin", "yago", "yahoo_geoplanet", "yale_senselab", "yovisto",
+ "ysa", "zaragoza-datosabiertos", "zaragoza-turismo", "zbw-pressemappe20",
+ "zhishi-me", "zitgist-musicbrainz"]}'
+ http_version:
+ recorded_at: Thu, 22 Mar 2012 04:40:45 GMT
+recorded_with: VCR 2.0.0
View
39 spec/ckan/group_spec.rb
@@ -0,0 +1,39 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe CKAN::Group do
+ before(:all) do
+ @art_group = CKAN::Group.new("art")
+ end
+
+ describe "initialization" do
+ subject { @art_group }
+ its(:id) { should == "art" }
+ its(:name) { should == "art" }
+ end
+
+ describe "#find", :vcr => { :cassette_name => "find all groups" } do
+ let(:all_groups) { CKAN::Group.find }
+
+ it "should return an array of all groups" do
+ all_groups.should be_kind_of Array
+ all_groups.count.should >= 80
+ end
+
+ it "should consist of Group objects" do
+ all_groups.first.should be_kind_of Group
+ end
+ end
+
+ describe "#packages", :vcr => { :cassette_name => "find all group packages" } do
+ let(:art_group_packages) { @art_group.packages }
+
+ it "should return an array of all groups" do
+ art_group_packages.should be_kind_of Array
+ art_group_packages.count.should >= 10
+ end
+
+ it "should consist of Group objects" do
+ art_group_packages.first.should be_kind_of Package
+ end
+ end
+end
View
27 spec/ckan/model_spec.rb
@@ -0,0 +1,27 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe CKAN::Model do
+ subject { CKAN::Model }
+ describe "attributes" do
+ it { should respond_to(:site, :site=) }
+ it { should respond_to(:search, :search=) }
+ end
+
+
+ describe "class methods" do
+ let(:model) { CKAN::Model.new }
+
+ describe "#read_lazy_data" do
+ context "initialization" do
+ it "shouldn't set @lazy_data_read" do
+ model.instance_variable_defined?(:@lazy_data_read).should be false
+ end
+ end
+ end
+ end
+
+ describe "helper methods" do
+ it { should respond_to(:read_remote_json_data) }
+ it { should respond_to(:lazy_reader) }
+ end
+end
View
68 spec/ckan/package_spec.rb
@@ -0,0 +1,68 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe CKAN::Package, :vcr => { :cassette_name => "colournames package" } do
+ before(:each) do
+ @art_package = CKAN::Package.new("colournames")
+ end
+
+ describe "initialization" do
+ subject { @art_package }
+ its(:id) { should == "colournames" }
+ end
+
+ describe "#find" do
+ context "without search options", :vcr => { :cassette_name => "find all packages" } do
+ let(:all_packages) { CKAN::Package.find }
+
+ it "should return an array of all packages" do
+ all_packages.should be_kind_of Array
+ all_packages.count.should be_between(1000,10000)
+ end
+
+ it "should consist of Package objects" do
+ all_packages.first.should be_kind_of Package
+ end
+ end
+
+ context "with search options", :vcr => { :cassette_name => "find packages tagged lod and government" } do
+ let(:tagged_packages) { CKAN::Package.find(:tags => ["lod", "government"]) }
+
+ it "should return an array of tagged packages" do
+ tagged_packages.should be_kind_of Array
+ tagged_packages.count.should be_between(100,1000)
+ end
+
+ it "should consist of Package objects" do
+ tagged_packages.first.should be_kind_of Package
+ end
+ end
+ end
+
+ describe "#resources" do
+ it "should change the package object's ID in place" do
+ @art_package.id.should eq "colournames"
+ @art_package.resources
+ @art_package.id.should eq "53587fae-fb5f-46e5-ae55-14f9951d0808"
+ end
+
+ it "should return details about an individual package" do
+ @art_package.resources
+ @art_package.url.should eq "http://blog.doloreslabs.com/2008/03/our-color-names-data-set-is-online/"
+ end
+ end
+
+ describe "#to_s" do
+ context "before resource request" do
+ it "should return the package ID in a string" do
+ @art_package.to_s.should eq "CKAN::Package[colournames]"
+ end
+ end
+
+ context "after resource request" do
+ it "should return the updated package ID in a string" do
+ @art_package.resources
+ @art_package.to_s.should eq "CKAN::Package[53587fae-fb5f-46e5-ae55-14f9951d0808]"
+ end
+ end
+ end
+end
View
11 spec/ckan/resource_spec.rb
@@ -0,0 +1,11 @@
+require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
+
+describe CKAN::Resource do
+ subject do
+ CKAN::Resource.new("url", "format", "description", "hash")
+ end
+
+ it "should return a Resource object" do
+ subject.should be_kind_of(CKAN::Resource)
+ end
+end
View
9 spec/ckan_spec.rb
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe CKAN do
+ describe "API_BASE" do
+ it "should have an API_BASE constant" do
+ CKAN::API_BASE.should eq "http://ckan.net/api/1/"
+ end
+ end
+end
View
16 spec/spec_helper.rb
@@ -0,0 +1,16 @@
+require File.expand_path(File.dirname(__FILE__) + '/../lib/ckan')
+require 'vcr'
+
+VCR.configure do |c|
+ c.hook_into :webmock
+ c.cassette_library_dir = 'spec/cassettes'
+ c.configure_rspec_metadata!
+end
+
+RSpec.configure do |config|
+ config.treat_symbols_as_metadata_keys_with_true_values = true
+ config.run_all_when_everything_filtered = true
+ config.filter_run :focus
+end
+
+include CKAN

0 comments on commit 76a362e

Please sign in to comment.