Top Level Namespace

Defined Under Namespace

Modules: Spree Classes: String

Constant Summary collapse

JSON_API_INCLUDES_DESCRIPTION =
'Select which associated resources you would like to fetch'\
', see: <a href="https://jsonapi.org/format/#fetching-includes">'\
'https://jsonapi.org/format/#fetching-includes</a>'.freeze
JSON_API_FILTER_DESCRIPTION =
''

Instance Method Summary collapse

Instance Method Details

#ensure_order_totalsObject



1
2
3
4
# File 'lib/spree/api/testing_support/v2/current_order.rb', line 1

def ensure_order_totals
  order.update_totals
  order.persist_totals
end

#json_api_filter_parameter(examples = []) ⇒ Object



67
68
69
70
71
72
73
74
75
# File 'lib/spree/api/testing_support/v2/platform_contexts.rb', line 67

def json_api_filter_parameter(examples = [])
  examples.each do |api_filter|
    name = api_filter[:name].to_sym
    example = api_filter[:example]
    let(name) { nil }

    parameter name: name, in: :query, type: :string, description: JSON_API_FILTER_DESCRIPTION, example: example
  end
end

#json_api_include_parameter(example = '') ⇒ Object



62
63
64
65
# File 'lib/spree/api/testing_support/v2/platform_contexts.rb', line 62

def json_api_include_parameter(example = '')
  let(:include) { nil }
  parameter name: :include, in: :query, type: :string, description: JSON_API_INCLUDES_DESCRIPTION, example: example
end

#with_webhooks_enabledObject



63
64
65
66
67
# File 'lib/spree/api/testing_support/matchers/webhooks.rb', line 63

def with_webhooks_enabled
  ENV['DISABLE_SPREE_WEBHOOKS'] = nil
  yield
  ENV['DISABLE_SPREE_WEBHOOKS'] = 'true'
end