Top Level Namespace
- Extended by:
- RSpecApi::DSL
Defined Under Namespace
Modules: Authorize, RSpecApi, RspecApi
Instance Method Summary collapse
- #app ⇒ Object
-
#resource(name, args = {}, &block) ⇒ Object
Alternatively, you replace ‘describe` with `resource`, for the same result:.
Methods included from RSpecApi::DSL::Fixtures
#apply, #create_fixture, #destroy_fixture, #existing, #existing_value_for, #invalid, #missing_value_for, #unknown, #valid
Methods included from RSpecApi::DSL::Attributes
#attributes_of, #has_attribute
Methods included from RSpecApi::DSL::Actions
Methods included from RSpecApi::DSL::Requests
#my_collection_request, #my_real_request, #request_with, #respond_with, #single_request
Methods included from RSpecApi::DSL::Accepts
#accepts_callback, #accepts_filter, #accepts_page, #accepts_sort
Instance Method Details
#app ⇒ Object
5 6 7 |
# File 'lib/rspec-api/http_clients/local.rb', line 5 def app Rails.application end |
#resource(name, args = {}, &block) ⇒ Object
Alternatively, you replace ‘describe` with `resource`, for the same result:
resource :artist do
... # same as before, here you can use `get`, `delete`, etc.
end
‘resource` is indeed the only top-level namespace RSpecApi method.
33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rspec-api/dsl.rb', line 33 def resource(name, args = {}, &block) args.merge! rspec_api: true resources = (@resources ||= []) resource = describe name.to_s.pluralize.humanize, args do @resource = name @resources = resources @expectations = [] @expectations << {query_params: {}, status_expect: {status: 200}, body_expect: {attributes: {name: {type: :string}, website: {type: [:null, string: :url]}}}} @attributes = {} instance_exec &block end @resources << resource end |