blob: 97d86fc79556b2990896928c66fab63c504f0297 (
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', format: :json
end
def add_defaults(args, defaults)
opts = args.extract_options!
opts.reverse_merge! defaults
args << opts
args
end
end
|