From: marios <[email protected]>
Signed-off-by: marios <[email protected]> --- .../tests/deltacloud/collections/storage_snapshots_collection_test.rb | 2 +- server/tests/deltacloud/common.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/tests/deltacloud/collections/storage_snapshots_collection_test.rb b/server/tests/deltacloud/collections/storage_snapshots_collection_test.rb index f2e4f1c..7d8060b 100644 --- a/server/tests/deltacloud/collections/storage_snapshots_collection_test.rb +++ b/server/tests/deltacloud/collections/storage_snapshots_collection_test.rb @@ -41,7 +41,7 @@ describe Deltacloud::Collections::StorageSnapshots do end it 'properly serialize attributes in JSON' do - check_json_serialization_for :storage_snapshot, 'snap1' + check_json_serialization_for :storage_snapshot, 'snap1', [:name, :description] end end diff --git a/server/tests/deltacloud/common.rb b/server/tests/deltacloud/common.rb index e603a24..1c3f45c 100644 --- a/server/tests/deltacloud/common.rb +++ b/server/tests/deltacloud/common.rb @@ -13,7 +13,7 @@ end Deltacloud.require_frontend! -def check_json_serialization_for(model, sample_id) +def check_json_serialization_for(model, sample_id, optional_attrs=[]) header 'Accept', 'application/json' get root_url + "/#{model.to_s.pluralize}" status.must_equal 200 @@ -24,6 +24,6 @@ def check_json_serialization_for(model, sample_id) klass = self.class.const_get(model.to_s.camelize) klass.attributes.each do |attr| attr = attr.to_s.gsub(/_id$/,'') if attr.to_s =~ /_id$/ - json[model.to_s].keys.must_include attr.to_s + json[model.to_s].keys.must_include attr.to_s unless optional_attrs.include? attr end end -- 1.7.11.7
