Permalink
Browse files

add ability to delete client apps

  • Loading branch information...
1 parent 4cf41a6 commit 073104f98c2f4651613fa0b33d1760c2a308247c @dtykocki dtykocki committed Nov 9, 2013
View
@@ -7,5 +7,6 @@ test/dummy/tmp/
.DS_Store
.rvmrc
coverage/
+*.swp
-Gemfile.lock
+Gemfile.lock
@@ -38,6 +38,12 @@ def create
end
end
+ def destroy
+ @client_app = client_app
+ @client_app.destroy
+ redirect_to oauth_client_apps_path
+ end
+
def client_app
Opro::Oauth::ClientApp.where(id: params[:id], user_id: current_user.id).first
end
@@ -10,6 +10,7 @@
<tr><td>Client Secret: </td><td> <%= client_app.app_secret %></td></tr>
</table>
<%= link_to "edit", edit_oauth_client_app_path(client_app) %>
+ <%= link_to "delete", oauth_client_app_path(client_app), method: :delete, data: { confirm: "Are you sure?" } %>
<hr />
<%- end -%>
<%- end -%>
@@ -48,4 +48,14 @@ class ClientAppControllerTest < ActiveSupport::IntegrationCase
assert_equal oauth_client_apps_path, current_path
end
+ test 'delete existing client application' do
+ app = create_client_app
+ as_user(app.user).visit oauth_client_apps_path
+
+ click_link 'delete'
+
+ refute has_content?(app.name)
+ assert_equal oauth_client_apps_path, current_path
+ end
+
end

0 comments on commit 073104f

Please sign in to comment.