Method: RSpec::Resources::DSL#describe_resource

Defined in:
lib/rspec/resources/dsl.rb

#describe_resource(base_path, options = {}, &block) ⇒ Object

Custom describe block that sets metadata to enable easy resource testing. In contrast to ‘#describe_resources` this method is meant for resources where only one instance exists. This directly correlates with the `resource` directive of the rails routes file.

describe_resources '/v1/profile', meta: :data do
  # ...
end

Params:

base_path

The resource base path, typically the one of the get action

options

RSpec’s ‘describe` metadata arguments

block

Block to pass into describe



39
40
41
# File 'lib/rspec/resources/dsl.rb', line 39

def describe_resource(base_path, options = {}, &block)
  abstract_describe(base_path, { single_resource: true }.merge(options), &block)
end