-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgroups_spec.rb
44 lines (37 loc) · 982 Bytes
/
groups_spec.rb
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'rails_helper'
module Committee
class RequestUnpacker
def unpack_query_params(request)
pp request.GET
pp request.POST
@allow_query_params ? self.class.indifferent_params(request.GET) : {}
end
end
end
RSpec.describe "/groups", type: :request do
include Committee::Test::Methods
include Rack::Test::Methods
def committee_options
@committee_options ||= { schema: Committee::Drivers::load_from_file('swagger/swagger.yml') }
end
def request_object
last_request
end
def response_data
[last_response.status, last_response.headers, last_response.body]
end
describe "GET /groups" do
it "returns ok" do
Group.create!
get groups_url, { limit: 1 }, as: :json
assert_schema_conform 200
end
end
describe "PATCH /groups/:id" do
it "returns ok" do
group = Group.create!
patch group_url(group), { name: "something" }, as: :json
assert_schema_conform 200
end
end
end