Sha256: 4f2707e7d747141660a494b4b0a34a2aed9fcb20ba34a98582e0bafdacee8836

Contents?: true

Size: 964 Bytes

Versions: 1

Compression:

Stored size: 964 Bytes

Contents

require 'rspec-api/dsl/requests'

module RSpecApi
  module DSL
    module Actions
      include RSpecApi::DSL::Fixtures
      include RSpecApi::DSL::Requests

      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

      define_action :get
      define_action :put
      define_action :patch
      define_action :post
      define_action :delete
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rspec-api-0.5.0 lib/rspec-api/dsl/actions.rb