Module: RSpecApi::DSL::Actions

Includes:
Fixtures, Requests
Included in:
RSpecApi::DSL
Defined in:
lib/rspec-api/dsl/actions.rb

Class Method Summary collapse

Methods included from Requests

#my_collection_request, #my_real_request, #request_with, #respond_with, #single_request

Methods included from Fixtures

#apply, #create_fixture, #destroy_fixture, #existing, #existing_value_for, #invalid, #missing_value_for, #unknown, #valid

Class Method Details

.define_action(action) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/rspec-api/dsl/actions.rb', line 9

def self.define_action(action)
  define_method action do |route, options = {}, &block|
    expectations = @expectations
    attributes = @attributes
    authorization = @authorization
    resource = @resource
    collection = options[:collection]
    describe "#{action.upcase} #{route}" do
      @action = action
      @route = route
      @expectations = expectations
      @attributes = attributes
      @authorization = authorization
      @collection = collection
      @resource = resource
      instance_eval &block
    end
  end
end