Module: Rspec::ApiHelpers

Defined in:
lib/rspec/api_helpers.rb,
lib/rspec/api_helpers/dispatcher.rb,
lib/rspec/api_helpers/example_methods.rb,
lib/rspec/api_helpers/example_group_methods.rb

Defined Under Namespace

Modules: ExampleGroupMethods, ExampleMethods Classes: Dispatcher

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.adapterObject

Returns the value of attribute adapter.



10
11
12
# File 'lib/rspec/api_helpers.rb', line 10

def adapter
  @adapter
end

Class Method Details

.included(receiver) ⇒ Object



13
14
15
16
# File 'lib/rspec/api_helpers.rb', line 13

def self.included(receiver)
  receiver.extend         ExampleGroupMethods
  receiver.send :include, ExampleMethods
end

.with(adapter:) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rspec/api_helpers.rb', line 18

def self.with(adapter:)
  if adapter.is_a?(Class)
    self.adapter = adapter
  else
    case adapter.to_s.to_sym
    when :active_model
      self.adapter = Adapter::ActiveModel
    when :json_api
      self.adapter = Adapter::JsonApi
    end
  end

  return self
end