class Object

Public Instance Methods

resource(name, args = {}, &block) click to toggle source

You can also have the methods available in a RSpec Example group using ‘resource`. This is the only method that RSpecApi adds to the top-level namespace and it’s equivalent to a ‘describe` block with RSpecApi::Resource:

@example Describe the resource artist:

resource :artist do
   ... # here you can write `get`, `has_attribute`, `host`, etc.
end
# File lib/rspec-api/resource.rb, line 44
def resource(name, args = {}, &block)
  describe name.to_s.pluralize.humanize, args do
    extend RSpecApi::Resource
    rspec_api_resource[:resource_name] = name
    instance_exec &block
  end
end