Commit 187d513c authored by James Lopez's avatar James Lopez

fix specs

parent 0a0d4ac2
......@@ -19,7 +19,7 @@ class Admin::ApplicationsController < Admin::ApplicationController
end
def create
@application = Applications::CreateService.new(current_user, application_params)
@application = Applications::CreateService.new(current_user, application_params.merge(ip_address: request.remote_ip)).execute
if @application.persisted?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
......@@ -51,6 +51,6 @@ class Admin::ApplicationsController < Admin::ApplicationController
# Only allow a trusted parameter "white list" through.
def application_params
params.require(:doorkeeper_application).permit(:name, :redirect_uri, :trusted, :scopes).merge(ip_address: request.remote_ip)
params.require(:doorkeeper_application).permit(:name, :redirect_uri, :trusted, :scopes)
end
end
......@@ -16,7 +16,7 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
end
def create
@application = Applications::CreateService.new(current_user, application_params)
@application = Applications::CreateService.new(current_user, create_application_params).execute
if @application.persited?
flash[:notice] = I18n.t(:notice, scope: [:doorkeeper, :flash, :applications, :create])
......@@ -55,8 +55,8 @@ class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
render "errors/not_found", layout: "errors", status: 404
end
def application_params
super.tap do |params|
def create_application_params
application_params.tap do |params|
params[:doorkeeper_application][:owner] = current_user
params[:ip_address] = request.remote_ip
end
......
......@@ -12,7 +12,7 @@ class Profiles::KeysController < Profiles::ApplicationController
end
def create
@key = Keys::CreateService.new(current_user, key_params).execute
@key = Keys::CreateService.new(current_user, key_params.merge(ip_address: request.remote_ip)).execute
if @key.persisted?
redirect_to profile_key_path(@key)
......@@ -54,6 +54,6 @@ class Profiles::KeysController < Profiles::ApplicationController
private
def key_params
params.require(:key).permit(:title, :key).merge(ip_address: request.remote_ip)
params.require(:key).permit(:title, :key)
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment