Permalink
Browse files

Added route accounts/:id/journal to display account transactions

  • Loading branch information...
1 parent 8eacdb1 commit 37030d7dd88a86ecccf955de008a6f6164f76d3c @arafatm arafatm committed Dec 30, 2008
Showing with 16 additions and 1 deletion.
  1. +5 −0 app/controllers/accounts_controller.rb
  2. +1 −1 config/routes.rb
  3. +10 −0 spec/controllers/accounts_controller_spec.rb
@@ -23,6 +23,7 @@ def create
render :action => "new"
end
end
+
def update
self.resource = find_resource
resource.attributes = params[resource_name]
@@ -38,6 +39,10 @@ def inactive
self.resources = resource_service.inactive
end
+ def journal
+ self.resource = find_resource
+ end
+
protected
end
View
@@ -8,7 +8,7 @@
map.resource :session
- map.resources :accounts, :collection =>{:inactive => :get}
+ map.resources :accounts, :collection =>{:inactive => :get}, :member => {:journal => :get}
map.resources :journals
map.resources :categories
@@ -139,3 +139,13 @@ def finder
end
end
+describe AccountsController, 'handling GET /singular (journal)' do
+ it 'should assign the selected account' do
+ login_as User.generate
+ account = stub(:account, :id => 666)
+ Account.expects(:find).with("666").returns(account)
+ get :journal, :id => "666"
+ assigns[:account].should_not be_nil
+ end
+end
+

0 comments on commit 37030d7

Please sign in to comment.