Module: RSpecApi::Resource::HasAttribute
- Included in:
- RSpecApi::Resource
- Defined in:
- lib/rspec-api/resource/has_attribute.rb
Instance Method Summary collapse
Instance Method Details
#has_attribute(name, options, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/rspec-api/resource/has_attribute.rb', line 7 def has_attribute(name, , &block) if block_given? [:type] = Hash[[:type], {}] nest_attributes [:type], &Proc.new end if @attribute_ancestors.present? hash = @attribute_ancestors.last hash.each{|type, _| (hash[type] ||= {})[name] = } else (rspec_api_resource[:attributes] ||= {})[name] = end end |