Remove JSON root from client controller

Signed-off-by: theworldbright <kent@kentshikama.com>
This commit is contained in:
theworldbright 2015-08-02 01:11:24 +09:00
parent 308170f691
commit dd337d4163
4 changed files with 6 additions and 6 deletions

View file

@ -12,7 +12,7 @@ module Api
def create
registrar = OpenIDConnect::Client::Registrar.new(request.url, params)
client = Api::OpenidConnect::OAuthApplication.register! registrar
render json: client
render json: client.as_json(root: false)
end
private

View file

@ -8,8 +8,8 @@ o_auth_query_params = %i(
Given /^I send a post request from that client to the code flow authorization endpoint$/ do
client_json = JSON.parse(last_response.body)
@client_id = client_json['o_auth_application']['client_id']
@client_secret = client_json['o_auth_application']['client_secret']
@client_id = client_json["client_id"]
@client_secret = client_json["client_secret"]
visit new_api_openid_connect_authorization_path +
"?client_id=#{@client_id}&#{o_auth_query_params}"
end

View file

@ -9,7 +9,7 @@ o_auth_query_params = %i(
Given /^I send a post request from that client to the implicit flow authorization endpoint$/ do
client_json = JSON.parse(last_response.body)
visit new_api_openid_connect_authorization_path +
"?client_id=#{client_json['o_auth_application']['client_id']}&#{o_auth_query_params}"
"?client_id=#{client_json["client_id"]}&#{o_auth_query_params}"
end
Given /^I send a post request from that client to the implicit flow authorization endpoint using a invalid client id/ do

View file

@ -10,8 +10,8 @@ describe Api::OpenidConnect::ClientsController, type: :controller do
policy_uri: "http://example.com/policy", tos_uri: "http://example.com/tos",
sector_identifier_uri: "http://example.com/uris", subject_type: "pairwise"
client_json = JSON.parse(response.body)
expect(client_json["o_auth_application"]["client_id"].length).to eq(32)
expect(client_json["o_auth_application"]["ppid"]).to eq(true)
expect(client_json["client_id"].length).to eq(32)
expect(client_json["ppid"]).to eq(true)
end
end
context "when redirect uri is missing" do