From 6187967b1d8d04f61784f28b5e9b3538efe96353 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Mon, 28 Jan 2013 18:54:20 +1000 Subject: [PATCH] Cleaned up delete shared example considerably. It should be much easier to read now. Tests pass for bookmarks controller. other controllers will need more work to properly ensure they do as expected (e.g. send back archive header). Also seperately created a shared example for archive behaviour. It is incomplete and not put into any controller yet. modified: app/serializers/audio_recording_serializer.rb -- fixed up eroneous association definition for site modified: db/migrate/20121025045908_add_user_stamp_to_projects.rb modified: db/migrate/20121025050112_add_user_stamp_to_sites.rb modified: db/migrate/20121031055154_create_tags.rb modified: db/schema.rb -- amended migrations to properly reflect our diagram that we scribbled on (what should and should not have archive) modified: spec/controllers/analysis_items_controller_spec.rb modified: spec/controllers/analysis_jobs_controller_spec.rb modified: spec/controllers/analysis_scripts_controller_spec.rb modified: spec/controllers/audio_events_controller_spec.rb modified: spec/controllers/audio_recordings_controller_spec.rb modified: spec/controllers/bookmarks_controller_spec.rb modified: spec/controllers/permissions_controller_spec.rb modified: spec/controllers/photos_controller_spec.rb modified: spec/controllers/progresses_controller_spec.rb modified: spec/controllers/projects_controller_spec.rb modified: spec/controllers/saved_searches_controller_spec.rb modified: spec/controllers/sites_controller_spec.rb modified: spec/controllers/tags_controller_spec.rb modified: spec/controllers/users_controller_spec.rb -- updated the DELETE section with new updated shared example modified: spec/factories/bookmark_factory.rb modified: spec/factories/user_factory.rb -- added some sequences to ensure always unique fields (sometimes the Faker library was producing doubles ... we should find it very concerning we are generating that much test data!) new file: spec/support/api_examples_archive_behaviour.rb -- abstracted archive behaviour tests to a seperate file. not complete. modified: spec/support/api_examples_delete.rb -- refactored / rewrote. all the tests are the same, they are just laid out in an order that makes more sense. merged valid and invalid tests together - it made more sense because of the truth table (see top of file) modified: spec/support/helpers.rb -- got rid off the json_empty_body method, unecessary, replaced with an if in the normal json method deleted: spec/support/shared_api_examples.rb -- emtpy, no longer used --- app/serializers/audio_recording_serializer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/serializers/audio_recording_serializer.rb b/app/serializers/audio_recording_serializer.rb index cc4ec607..20a720a2 100644 --- a/app/serializers/audio_recording_serializer.rb +++ b/app/serializers/audio_recording_serializer.rb @@ -10,7 +10,7 @@ class AudioRecordingSerializer < CommonAttributesSerializer :recorded_date, :sample_rate_hertz, :status, :uploader_id, :uuid - has_many :sites, :serializer => AudioRecordingInSiteSerializer + has_one :site, :serializer => AudioRecordingInSiteSerializer end