Module: Restspec

Includes:
ActiveSupport::Configurable
Defined in:
lib/restspec.rb,
lib/restspec/version.rb,
lib/restspec/shortcuts.rb,
lib/restspec/schema/dsl.rb,
lib/restspec/schema/types.rb,
lib/restspec/configuration.rb,
lib/restspec/endpoints/dsl.rb,
lib/restspec/schema/schema.rb,
lib/restspec/schema/checker.rb,
lib/restspec/requirements/dsl.rb,
lib/restspec/rspec/api_macros.rb,
lib/restspec/schema/attribute.rb,
lib/restspec/endpoints/network.rb,
lib/restspec/endpoints/request.rb,
lib/restspec/rspec/api_helpers.rb,
lib/restspec/values/super_hash.rb,
lib/restspec/endpoints/endpoint.rb,
lib/restspec/endpoints/response.rb,
lib/restspec/values/status_code.rb,
lib/restspec/endpoints/namespace.rb,
lib/restspec/stores/schema_store.rb,
lib/restspec/schema/schema_example.rb,
lib/restspec/stores/endpoint_store.rb,
lib/restspec/stores/namespace_store.rb,
lib/restspec/requirements/requirement.rb,
lib/restspec/runners/docs/docs_runner.rb,
lib/restspec/schema/attribute_example.rb,
lib/restspec/runners/install/install_runner.rb

Defined Under Namespace

Modules: Endpoints, HeaderTests, RSpec, Requirements, Schema, Stores, Values Classes: DocsRunner, InstallRunner

Constant Summary collapse

VERSION =
"0.0.4"
SchemaStore =
Stores::SchemaStore
EndpointStore =
Stores::EndpointStore
NamespaceStore =
Stores::NamespaceStore

Class Method Summary collapse

Class Method Details

.configure {|config| ... } ⇒ Object

Yields:

  • (config)


7
8
9
10
11
12
13
14
15
16
17
# File 'lib/restspec/configuration.rb', line 7

def configure
  config.request = OpenStruct.new(headers: {})
  config.request.headers['Content-Type'] = 'application/json'
  config.request.headers['Accept'] = 'application/json'

  config.custom = OpenStruct.new

  yield config

  populate_stores
end

.example_for(schema_name, extensions = {}) ⇒ Object



3
4
5
6
# File 'lib/restspec/shortcuts.rb', line 3

def example_for(schema_name, extensions = {})
  schema = Restspec::SchemaStore.get(schema_name)
  Schema::SchemaExample.new(schema, extensions).value
end

.populate_storesObject



19
20
21
22
23
# File 'lib/restspec/configuration.rb', line 19

def populate_stores
  load_schemas
  load_endpoint_definition
  load_requirement_definition
end