Add pd declaration create action
This commit is contained in:
parent
0f51052e86
commit
7d6ac34fbc
4 changed files with 25 additions and 1 deletions
|
@ -38,6 +38,7 @@ class Ability
|
|||
can [:read, :create, :destroy], :oauth2_authorization
|
||||
can [:update, :destroy], :account
|
||||
can :update, :account_terms
|
||||
can :create, :account_pd_declaration
|
||||
can :read, :dashboard
|
||||
can [:create, :subscribe, :unsubscribe], DiaryEntry
|
||||
can :update, DiaryEntry, :user => user
|
||||
|
|
|
@ -8,5 +8,9 @@ module Accounts
|
|||
authorize_resource :class => :account_pd_declaration
|
||||
|
||||
def show; end
|
||||
|
||||
def create
|
||||
redirect_to edit_account_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -279,7 +279,7 @@ OpenStreetMap::Application.routes.draw do
|
|||
resource :account, :only => [:edit, :update, :destroy] do
|
||||
scope :module => :accounts do
|
||||
resource :terms, :only => [:show, :update]
|
||||
resource :pd_declaration, :only => :show
|
||||
resource :pd_declaration, :only => [:show, :create]
|
||||
resource :deletion, :only => :show
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,6 +9,10 @@ module Accounts
|
|||
{ :path => "/account/pd_declaration", :method => :get },
|
||||
{ :controller => "accounts/pd_declarations", :action => "show" }
|
||||
)
|
||||
assert_routing(
|
||||
{ :path => "/account/pd_declaration", :method => :post },
|
||||
{ :controller => "accounts/pd_declarations", :action => "create" }
|
||||
)
|
||||
end
|
||||
|
||||
def test_show_not_logged_in
|
||||
|
@ -25,5 +29,20 @@ module Accounts
|
|||
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
def test_create_not_logged_in
|
||||
post account_pd_declaration_path
|
||||
|
||||
assert_response :forbidden
|
||||
end
|
||||
|
||||
def test_create
|
||||
user = create(:user)
|
||||
session_for(user)
|
||||
|
||||
post account_pd_declaration_path
|
||||
|
||||
assert_redirected_to edit_account_path
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue