summaryrefslogtreecommitdiff
path: root/test/support/api_controller_test.rb
blob: 06cb46a13544da438ea6fb32b9f3b2d2d36f5646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
class ApiControllerTest < ActionController::TestCase

  def api_get(*args)
    get *add_api_defaults(args)
  end

  def api_post(*args)
    post *add_api_defaults(args)
  end

  def api_delete(*args)
    delete *add_api_defaults(args)
  end

  def api_put(*args)
    put *add_api_defaults(args)
  end

  def add_api_defaults(args)
    add_defaults args, version: '2'
  end

  def add_defaults(args, defaults)
    opts = args.extract_options!
    opts.reverse_merge! defaults
    args << opts
    args
  end
end