lib/restspec/endpoints/has_schemas.rb in restspec-0.1 vs lib/restspec/endpoints/has_schemas.rb in restspec-0.2
- old
+ new
@@ -1,6 +1,7 @@
require 'active_support/concern'
+require 'deep_clone'
module Restspec
module Endpoints
module HasSchemas
extend ActiveSupport::Concern
@@ -14,10 +15,15 @@
def add_schema(schema_name, options)
roles = options.delete(:for) || DEFAULT_ROLES
roles.each do |role|
- schema_roles[role] = Restspec::SchemaStore.fetch(schema_name).clone
+ schema_found = Restspec::SchemaStore.fetch(schema_name)
+
+ schema_roles[role] = DeepClone.clone(schema_found)
+ schema_roles[role].intention = role
+ schema_roles[role].original_schema = schema_found
+
if options.any?
schema_roles[role].extend_with(options)
end
end
end