Module: RSpec::Resources
- Defined in:
- lib/rspec/resources.rb,
lib/rspec/resources/dsl.rb,
lib/rspec/resources/util.rb,
lib/rspec/resources/version.rb,
lib/rspec/resources/dsl/actions.rb,
lib/rspec/resources/dsl/matchers.rb,
lib/rspec/resources/configuration.rb,
lib/rspec/resources/document_formats.rb,
lib/rspec/resources/dsl/characteristics.rb,
lib/rspec/resources/dsl/matchers/error_matcher.rb,
lib/rspec/resources/dsl/actions/include_if_needed.rb,
lib/rspec/resources/dsl/matchers/json_model_matcher.rb
Defined Under Namespace
Modules: DSL, Util Classes: Configuration
Constant Summary collapse
- VERSION =
'0.2.0'
- DOCUMENT_FORMATS =
{ # Resource end points with most simple data format # Example response: # { # "id": "5", # "text": "Loren ipsum" # } simple: { # path to the content of the response base_path: '', # path to the resource id relative to base path id_path: 'id', # path to the attributes section of the resource relative to base path attributes_path: '', # path to error objects; may either be an array or a single object error_path: '', # the path to the error message relative to an error object (see error_path) error_detail_path: 'message', }.freeze, # Resource end points with simple data format wrapped in a data field # Example response: # { # "data": { # "id": "5", # "text": "Loren ipsum" # } # } simple_wrapped: { # path to the content of the response base_path: 'data', # path to the resource id relative to base path id_path: 'id', # path to the attributes section of the resource relative to base path attributes_path: '', # path to error objects; may either be an array or a single object error_path: 'errors', # the path to the error message relative to an error object (see error_path) error_detail_path: 'message', }.freeze, # Resource end points conforming to json api specification (http://jsonapi.org/) # Example response: # { # "data": { # "id": "5", # "type": "article", # "attributes": { # "text": "Loren ipsum" # } # } # } jsonapi: { # path to the content of the response base_path: 'data', # path to the resource id relative to base path id_path: 'id', # path to the attributes section of the resource relative to base path attributes_path: 'attributes', # path to error objects; may either be an array or a single object error_path: 'errors', # the path to the error message relative to an error object (see error_path) error_detail_path: 'detail', }.freeze, }.freeze
Class Method Summary collapse
- .configuration ⇒ Object
-
.configure {|configuration| ... } ⇒ Object
Configures rspec-resources.
Class Method Details
.configuration ⇒ Object
16 17 18 |
# File 'lib/rspec/resources.rb', line 16 def self.configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object
27 28 29 |
# File 'lib/rspec/resources.rb', line 27 def self.configure yield configuration if block_given? end |