plutus 0.11.0 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +47 -31
- data/app/assets/javascripts/plutus/application.js +5 -4
- data/app/assets/javascripts/plutus/reports.js.coffee +2 -0
- data/app/assets/stylesheets/bootstrap-theme.min.css +5 -0
- data/app/assets/stylesheets/bootstrap.min.css +5 -0
- data/app/assets/stylesheets/plutus/application.css +11 -5
- data/app/controllers/plutus/accounts_controller.rb +1 -16
- data/app/controllers/plutus/application_controller.rb +4 -0
- data/app/controllers/plutus/entries_controller.rb +2 -17
- data/app/controllers/plutus/reports_controller.rb +40 -0
- data/app/models/plutus/account.rb +90 -7
- data/app/models/plutus/amounts_extension.rb +28 -1
- data/app/models/plutus/asset.rb +20 -17
- data/app/models/plutus/entry.rb +6 -1
- data/app/models/plutus/equity.rb +21 -18
- data/app/models/plutus/expense.rb +20 -17
- data/app/models/plutus/liability.rb +26 -18
- data/app/models/plutus/revenue.rb +21 -18
- data/app/views/layouts/plutus/_messages.html.erb +9 -0
- data/app/views/layouts/plutus/_navigation.html.erb +19 -0
- data/app/views/layouts/plutus/_navigation_links.html.erb +5 -0
- data/app/views/layouts/plutus/application.html.erb +19 -0
- data/app/views/plutus/accounts/index.html.erb +9 -12
- data/app/views/plutus/entries/index.html.erb +14 -12
- data/app/views/plutus/reports/_account.html.erb +28 -0
- data/app/views/plutus/reports/balance_sheet.html.erb +21 -0
- data/app/views/plutus/reports/income_statement.html.erb +24 -0
- data/config/routes.rb +6 -3
- data/lib/generators/plutus/add_date_upgrade_generator.rb +11 -0
- data/lib/generators/plutus/base_generator.rb +19 -0
- data/lib/generators/plutus/plutus_generator.rb +8 -22
- data/lib/generators/plutus/templates/add_date_migration.rb +6 -0
- data/lib/generators/plutus/templates/migration.rb +3 -1
- data/lib/generators/plutus/templates/update_migration.rb +2 -2
- data/lib/generators/plutus/tenancy_generator.rb +2 -17
- data/lib/generators/plutus/upgrade_plutus_generator.rb +6 -22
- data/lib/plutus/version.rb +1 -1
- data/spec/controllers/accounts_controller_spec.rb +11 -20
- data/spec/controllers/entries_controller_spec.rb +11 -20
- data/spec/controllers/reports_controller_spec.rb +24 -0
- data/spec/models/account_spec.rb +7 -1
- data/spec/models/entry_spec.rb +9 -0
- data/spec/routing/accounts_routing_spec.rb +6 -25
- data/spec/routing/entries_routing_spec.rb +6 -25
- data/spec/spec_helper.rb +1 -0
- data/spec/support/account_shared_examples.rb +4 -0
- metadata +47 -6
- data/app/views/plutus/accounts/show.html.erb +0 -59
- data/app/views/plutus/entries/show.html.erb +0 -46
- data/spec/schema.rb +0 -31
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<
|
|
1
|
+
<div class="container">
|
|
2
|
+
<center>
|
|
3
|
+
<h1>General Ledger</h1>
|
|
4
|
+
<br>
|
|
5
|
+
</center>
|
|
3
6
|
|
|
4
|
-
<table>
|
|
7
|
+
<table class="table table-striped table-hover">
|
|
5
8
|
<tr>
|
|
6
|
-
<th class="nobg">ID</th>
|
|
7
9
|
<th>Name</th>
|
|
8
10
|
<th>Type</th>
|
|
9
11
|
<th>Credit Balance</th>
|
|
@@ -13,17 +15,12 @@
|
|
|
13
15
|
|
|
14
16
|
<% @accounts.each do |account| %>
|
|
15
17
|
<tr class="<%= cycle("even", "odd") -%>">
|
|
16
|
-
<td><%=link_to(account.id, account_path(account.id)) %></td>
|
|
17
18
|
<td><%=h account.name %></td>
|
|
18
19
|
<td><%=h account.type.sub('Plutus::','') %></td>
|
|
19
|
-
<td><%=h account.credits_balance %></td>
|
|
20
|
-
<td><%=h account.debits_balance %></td>
|
|
21
|
-
<td><%=h account.balance %></td>
|
|
20
|
+
<td><%=h account.credits_balance.round(2) %></td>
|
|
21
|
+
<td><%=h account.debits_balance.round(2) %></td>
|
|
22
|
+
<td><%=h account.balance.round(2) %></td>
|
|
22
23
|
</tr>
|
|
23
24
|
<% end %>
|
|
24
25
|
</table>
|
|
25
|
-
|
|
26
|
-
<br />
|
|
27
|
-
|
|
28
|
-
<h3>Go to <%= link_to 'Entries', entries_path %></h3>
|
|
29
26
|
</div>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
<div class="
|
|
2
|
-
<
|
|
1
|
+
<div class="container">
|
|
2
|
+
<center>
|
|
3
|
+
<h1>Journal</h1>
|
|
4
|
+
<br>
|
|
5
|
+
</center>
|
|
3
6
|
|
|
4
|
-
<table
|
|
7
|
+
<table class="table table-striped table-hover">
|
|
5
8
|
<thead>
|
|
6
9
|
<tr>
|
|
7
|
-
<th class="nobg">ID</th>
|
|
8
10
|
<th>Description</th>
|
|
9
11
|
<th>Debits</th>
|
|
10
12
|
<th>Credits</th>
|
|
@@ -14,7 +16,6 @@
|
|
|
14
16
|
<tbody>
|
|
15
17
|
<% @entries.each do |entry| %>
|
|
16
18
|
<tr class="<%= cycle("even", "odd") -%>">
|
|
17
|
-
<td><%=link_to(entry.id, entry_path(entry)) %></td>
|
|
18
19
|
<td><%=h entry.description %></td>
|
|
19
20
|
<td></td>
|
|
20
21
|
<td></td>
|
|
@@ -22,27 +23,28 @@
|
|
|
22
23
|
</tr>
|
|
23
24
|
<% entry.debit_amounts.each do |debit_amount| %>
|
|
24
25
|
<tr class="<%= cycle("odd", "odd") -%>">
|
|
25
|
-
<td></td>
|
|
26
26
|
<td> <%=h "#{debit_amount.account.name}" %></td>
|
|
27
|
-
<td><%=h debit_amount.amount %></td>
|
|
27
|
+
<td><%=h debit_amount.amount.round(2) %></td>
|
|
28
28
|
<td></td>
|
|
29
29
|
<td></td>
|
|
30
30
|
</tr>
|
|
31
31
|
<% end %>
|
|
32
32
|
<% entry.credit_amounts.each do |credit_amount| %>
|
|
33
33
|
<tr class="<%= cycle("odd", "odd") -%>">
|
|
34
|
-
<td></td>
|
|
35
34
|
<td> <%=h "#{credit_amount.account.name}" %></td>
|
|
36
35
|
<td></td>
|
|
37
|
-
<td><%=h credit_amount.amount %></td>
|
|
36
|
+
<td><%=h credit_amount.amount.round(2) %></td>
|
|
38
37
|
<td></td>
|
|
39
38
|
</tr>
|
|
40
39
|
<% end %>
|
|
40
|
+
<tr class="<%= cycle("odd", "odd") -%>">
|
|
41
|
+
<td></td>
|
|
42
|
+
<td></td>
|
|
43
|
+
<td></td>
|
|
44
|
+
<td></td>
|
|
45
|
+
</tr>
|
|
41
46
|
<% end %>
|
|
42
47
|
</tbody>
|
|
43
48
|
</table>
|
|
44
49
|
|
|
45
|
-
<br />
|
|
46
|
-
|
|
47
|
-
<h3>Go to <%= link_to 'Accounts', accounts_path %></h3>
|
|
48
50
|
</div>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<table class="table table-striped table-hover">
|
|
2
|
+
<caption class="text-left"><b><%=name%></b></caption>
|
|
3
|
+
<thead>
|
|
4
|
+
<tr>
|
|
5
|
+
<th></th>
|
|
6
|
+
<th></th>
|
|
7
|
+
</tr>
|
|
8
|
+
</thead>
|
|
9
|
+
<% if accounts.count > 0%>
|
|
10
|
+
<tbody>
|
|
11
|
+
<% running_total = 0 %>
|
|
12
|
+
<% accounts.each do |account| %>
|
|
13
|
+
<% balance = account.balance(:from_date => @from_date, :to_date => @to_date) %>
|
|
14
|
+
<tr class="<%= cycle("even", "odd") -%>">
|
|
15
|
+
<td><%=h account.name %></td>
|
|
16
|
+
<td><%=h balance.round(2) %></td>
|
|
17
|
+
<% running_total += balance %>
|
|
18
|
+
</tr>
|
|
19
|
+
<% end %>
|
|
20
|
+
<tr class="<%= cycle("even", "odd") -%>">
|
|
21
|
+
<strong>
|
|
22
|
+
<td>Total <%= name %></td>
|
|
23
|
+
<td><%= running_total.round(2) %></td>
|
|
24
|
+
</strong>
|
|
25
|
+
</tr>
|
|
26
|
+
</tbody>
|
|
27
|
+
<% end %>
|
|
28
|
+
</table>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<div class="container">
|
|
2
|
+
<center>
|
|
3
|
+
<h1>Balance Sheet</h1>
|
|
4
|
+
|
|
5
|
+
<%= form_tag({:action => 'balance_sheet'}, {:method => :get, :class => 'form-inline'}) do%>
|
|
6
|
+
<div class="form-group">
|
|
7
|
+
<%= label_tag :date, nil, class: 'sr-only'%>
|
|
8
|
+
<%= text_field_tag :date, @to_date, :class => 'datepicker form-control' %>
|
|
9
|
+
</div>
|
|
10
|
+
<button type="submit" class="btn btn-default">Get Report</button>
|
|
11
|
+
<% end %>
|
|
12
|
+
</center>
|
|
13
|
+
|
|
14
|
+
<br>
|
|
15
|
+
|
|
16
|
+
<%= render 'account', :name => "Assets", :accounts => @assets %>
|
|
17
|
+
<%= render 'account', :name => "Liabilities", :accounts => @liabilities %>
|
|
18
|
+
<%= render 'account', :name => "Equity", :accounts => @equity %>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
</div>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="container">
|
|
2
|
+
<center>
|
|
3
|
+
<h1>Income Statement</h1>
|
|
4
|
+
|
|
5
|
+
<%= form_tag({:action => 'income_statement'}, {:method => :get, :class => 'form-inline'}) do%>
|
|
6
|
+
<div class="form-group">
|
|
7
|
+
<%= label_tag :from_date, nil, class: 'sr-only'%>
|
|
8
|
+
<%= text_field_tag :from_date, @from_date, :class => 'datepicker form-control', :placeholder => "Date" %>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="form-group">
|
|
11
|
+
<%= label_tag :to_date, nil, class: 'sr-only'%>
|
|
12
|
+
<%= text_field_tag :to_date, @to_date, :class => 'datepicker form-control', :placeholder => "Date" %>
|
|
13
|
+
</div>
|
|
14
|
+
<button type="submit" class="btn btn-default">Get Report</button>
|
|
15
|
+
<% end %>
|
|
16
|
+
</center>
|
|
17
|
+
|
|
18
|
+
<br>
|
|
19
|
+
|
|
20
|
+
<%= render 'account', :name => "Revenues", :accounts => @revenues %>
|
|
21
|
+
<%= render 'account', :name => "Expenses", :accounts => @expenses %>
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
</div>
|
data/config/routes.rb
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
Plutus::Engine.routes.draw do
|
|
2
|
-
root :to =>
|
|
2
|
+
root :to => 'reports#balance_sheet'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
get 'reports/balance_sheet' => 'reports#balance_sheet'
|
|
5
|
+
get 'reports/income_statement' => 'reports#income_statement'
|
|
6
|
+
|
|
7
|
+
resources :accounts, only: [:index]
|
|
8
|
+
resources :entries, only: [:index]
|
|
6
9
|
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
require 'rails/generators'
|
|
2
|
+
require 'rails/generators/migration'
|
|
3
|
+
require_relative 'base_generator'
|
|
4
|
+
|
|
5
|
+
module Plutus
|
|
6
|
+
class AddDateUpgradeGenerator < BaseGenerator
|
|
7
|
+
def create_migration_file
|
|
8
|
+
migration_template 'add_date_migration.rb', 'db/migrate/add_date_to_plutus_entries.rb'
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Plutus
|
|
2
|
+
class BaseGenerator < Rails::Generators::Base
|
|
3
|
+
include Rails::Generators::Migration
|
|
4
|
+
|
|
5
|
+
def self.source_root
|
|
6
|
+
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
# Implement the required interface for Rails::Generators::Migration.
|
|
10
|
+
# See http://apidock.com/rails/ActiveRecord/Generators/Base/next_migration_number/class
|
|
11
|
+
def self.next_migration_number(dirname)
|
|
12
|
+
if ActiveRecord::Base.timestamped_migrations
|
|
13
|
+
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
14
|
+
else
|
|
15
|
+
"%.3d" % (current_migration_number(dirname) + 1)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -1,26 +1,12 @@
|
|
|
1
1
|
# lib/generators/plutus/plutus_generator.rb
|
|
2
2
|
require 'rails/generators'
|
|
3
3
|
require 'rails/generators/migration'
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
# Implement the required interface for Rails::Generators::Migration.
|
|
13
|
-
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
14
|
-
def self.next_migration_number(dirname)
|
|
15
|
-
if ActiveRecord::Base.timestamped_migrations
|
|
16
|
-
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
17
|
-
else
|
|
18
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def create_migration_file
|
|
23
|
-
migration_template 'migration.rb', 'db/migrate/create_plutus_tables.rb'
|
|
24
|
-
end
|
|
25
|
-
|
|
4
|
+
require_relative 'base_generator'
|
|
5
|
+
|
|
6
|
+
module Plutus
|
|
7
|
+
class PlutusGenerator < BaseGenerator
|
|
8
|
+
def create_migration_file
|
|
9
|
+
migration_template 'migration.rb', 'db/migrate/create_plutus_tables.rb'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
26
12
|
end
|
|
@@ -11,11 +11,13 @@ class CreatePlutusTables < ActiveRecord::Migration
|
|
|
11
11
|
|
|
12
12
|
create_table :plutus_entries do |t|
|
|
13
13
|
t.string :description
|
|
14
|
+
t.date :date
|
|
14
15
|
t.integer :commercial_document_id
|
|
15
16
|
t.string :commercial_document_type
|
|
16
17
|
|
|
17
18
|
t.timestamps
|
|
18
19
|
end
|
|
20
|
+
add_index :plutus_entries, :date
|
|
19
21
|
add_index :plutus_entries, [:commercial_document_id, :commercial_document_type], :name => "index_entries_on_commercial_doc"
|
|
20
22
|
|
|
21
23
|
create_table :plutus_amounts do |t|
|
|
@@ -23,7 +25,7 @@ class CreatePlutusTables < ActiveRecord::Migration
|
|
|
23
25
|
t.references :account
|
|
24
26
|
t.references :entry
|
|
25
27
|
t.decimal :amount, :precision => 20, :scale => 10
|
|
26
|
-
end
|
|
28
|
+
end
|
|
27
29
|
add_index :plutus_amounts, :type
|
|
28
30
|
add_index :plutus_amounts, [:account_id, :entry_id]
|
|
29
31
|
add_index :plutus_amounts, [:entry_id, :account_id]
|
|
@@ -5,10 +5,10 @@ class UpdatePlutusTables < ActiveRecord::Migration
|
|
|
5
5
|
remove_index :plutus_amounts, [:account_id, :transaction_id]
|
|
6
6
|
remove_index :plutus_amounts, [:transaction_id, :account_id]
|
|
7
7
|
remove_index :plutus_transactions, column: [:commercial_document_id, :commercial_document_type], :name => "index_transactions_on_commercial_doc"
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
rename_table :plutus_transactions, :plutus_entries
|
|
10
10
|
rename_column :plutus_amounts, :transaction_id, :entry_id
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
# adding the indexes back
|
|
13
13
|
add_index :plutus_amounts, [:account_id, :entry_id]
|
|
14
14
|
add_index :plutus_amounts, [:entry_id, :account_id]
|
|
@@ -1,25 +1,10 @@
|
|
|
1
1
|
# lib/generators/plutus/plutus_generator.rb
|
|
2
2
|
require 'rails/generators'
|
|
3
3
|
require 'rails/generators/migration'
|
|
4
|
+
require_relative 'base_generator'
|
|
4
5
|
|
|
5
6
|
module Plutus
|
|
6
|
-
class TenancyGenerator <
|
|
7
|
-
include Rails::Generators::Migration
|
|
8
|
-
|
|
9
|
-
def self.source_root
|
|
10
|
-
@source_root ||= File.join(File.dirname(__FILE__), 'templates')
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Implement the required interface for Rails::Generators::Migration.
|
|
14
|
-
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
15
|
-
def self.next_migration_number(dirname)
|
|
16
|
-
if ActiveRecord::Base.timestamped_migrations
|
|
17
|
-
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
18
|
-
else
|
|
19
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
7
|
+
class TenancyGenerator < BaseGenerator
|
|
23
8
|
def create_migration_file
|
|
24
9
|
migration_template 'tenant_migration.rb', 'db/migrate/tenant_plutus_tables.rb'
|
|
25
10
|
end
|
|
@@ -1,28 +1,12 @@
|
|
|
1
1
|
# lib/generators/plutus/plutus_generator.rb
|
|
2
2
|
require 'rails/generators'
|
|
3
3
|
require 'rails/generators/migration'
|
|
4
|
+
require_relative 'base_generator'
|
|
4
5
|
|
|
5
6
|
module Plutus
|
|
6
|
-
class UpgradePlutusGenerator <
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
# Implement the required interface for Rails::Generators::Migration.
|
|
14
|
-
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
|
15
|
-
def self.next_migration_number(dirname)
|
|
16
|
-
if ActiveRecord::Base.timestamped_migrations
|
|
17
|
-
Time.now.utc.strftime("%Y%m%d%H%M%S")
|
|
18
|
-
else
|
|
19
|
-
"%.3d" % (current_migration_number(dirname) + 1)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def create_migration_file
|
|
24
|
-
migration_template 'update_migration.rb', 'db/migrate/update_plutus_tables.rb'
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
end
|
|
7
|
+
class UpgradePlutusGenerator < BaseGenerator
|
|
8
|
+
def create_migration_file
|
|
9
|
+
migration_template 'update_migration.rb', 'db/migrate/update_plutus_tables.rb'
|
|
10
|
+
end
|
|
11
|
+
end
|
|
28
12
|
end
|
data/lib/plutus/version.rb
CHANGED
|
@@ -2,27 +2,18 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
module Plutus
|
|
4
4
|
describe AccountsController do
|
|
5
|
-
|
|
5
|
+
routes { Plutus::Engine.routes }
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#describe "GET index" do
|
|
12
|
-
#it "assigns all accounts as @accounts" do
|
|
13
|
-
#Account.stub(:find).with(:all).and_return([mock_account])
|
|
14
|
-
#get :index
|
|
15
|
-
#assigns[:accounts].should == [mock_account]
|
|
16
|
-
#end
|
|
17
|
-
#end
|
|
18
|
-
|
|
19
|
-
#describe "GET show" do
|
|
20
|
-
#it "assigns the requested account as @account" do
|
|
21
|
-
#Account.stub(:find).with("37").and_return(mock_account)
|
|
22
|
-
#get :show, :id => "37"
|
|
23
|
-
#assigns[:account].should equal(mock_account)
|
|
24
|
-
#end
|
|
25
|
-
#end
|
|
7
|
+
def mock_account(stubs={})
|
|
8
|
+
@mock_account ||= FactoryGirl.create(:asset)
|
|
9
|
+
end
|
|
26
10
|
|
|
11
|
+
describe "GET index" do
|
|
12
|
+
it "assigns all accounts as @accounts" do
|
|
13
|
+
Account.stub(:all).and_return([mock_account])
|
|
14
|
+
get :index
|
|
15
|
+
assigns[:accounts].should == [mock_account]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
27
18
|
end
|
|
28
19
|
end
|
|
@@ -2,27 +2,18 @@ require 'spec_helper'
|
|
|
2
2
|
|
|
3
3
|
module Plutus
|
|
4
4
|
describe EntriesController do
|
|
5
|
-
|
|
5
|
+
routes { Plutus::Engine.routes }
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
#describe "GET index" do
|
|
12
|
-
#it "assigns all entries as @entries" do
|
|
13
|
-
#Entry.stub(:find).with(:all).and_return([mock_entry])
|
|
14
|
-
#get :index
|
|
15
|
-
#assigns[:entries].should == [mock_entry]
|
|
16
|
-
#end
|
|
17
|
-
#end
|
|
18
|
-
|
|
19
|
-
#describe "GET show" do
|
|
20
|
-
#it "assigns the requested entry as @entry" do
|
|
21
|
-
#Entry.stub(:find).with("37").and_return(mock_entry)
|
|
22
|
-
#get :show, :id => "37"
|
|
23
|
-
#assigns[:entry].should equal(mock_entry)
|
|
24
|
-
#end
|
|
25
|
-
#end
|
|
7
|
+
def mock_entry(stubs={})
|
|
8
|
+
@mock_entry ||= FactoryGirl.create(:entry_with_credit_and_debit)
|
|
9
|
+
end
|
|
26
10
|
|
|
11
|
+
describe "GET index" do
|
|
12
|
+
it "assigns all entries as @entries" do
|
|
13
|
+
Entry.stub_chain(:limit, :order).and_return([mock_entry])
|
|
14
|
+
get :index
|
|
15
|
+
assigns[:entries].should == [mock_entry]
|
|
16
|
+
end
|
|
17
|
+
end
|
|
27
18
|
end
|
|
28
19
|
end
|