Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
f19751f
added faker gem and few dummy data to application works, also comment…
Oct 14, 2013
345f2c1
created seeds to bernard application
Oct 14, 2013
3941501
added category_id in the transactions view
Oct 14, 2013
cdbf570
Merge branch 'feature/create-seeds' into jose-romero
Oct 14, 2013
63fd48b
refactor seed to have relation between transactions and splits
Oct 15, 2013
3c9404c
change value from true to false
Oct 15, 2013
eae53a9
increased seeds to transactions and accounts
Oct 15, 2013
91ea57b
Merge branch 'feature/refactor-seed' into jose-romero
Oct 15, 2013
6a95470
added group test in gemfile
Oct 14, 2013
d82a9ad
added rspec-rails
Oct 14, 2013
b32d2aa
added some basic test
Oct 15, 2013
8649b02
added rspec_rails
Oct 15, 2013
cba86f2
added gems
Oct 15, 2013
2c68325
added factories to create account, category, department, payee and tr…
Oct 15, 2013
76ff137
added test at models
Oct 15, 2013
3d53fd0
Merge branch 'feature/add-basic-tests' into jose-romero
Oct 15, 2013
4803fe5
refactored seed in create transactions
Oct 15, 2013
6efcd2c
increased number of seeds
Oct 15, 2013
1da6913
Merge branch 'feature/refactor-seed' into jose-romero
Oct 15, 2013
46f7ab2
added factories and refactored factory to account
Oct 15, 2013
4ad4020
Merge branch 'feature/add-basic-tests' into jose-romero
Oct 15, 2013
53726c8
change factory split at transaction factory file
Oct 16, 2013
01f1af5
Merge branch 'feature/add-basic-tests' into jose-romero
Oct 16, 2013
c5a1ccc
created spec/controllers folder and test to index in TransactionsCont…
Oct 16, 2013
66e875d
added test to get methods
Oct 16, 2013
68a51ab
completed get methods
Oct 16, 2013
aad8e60
Merge branch 'feature/add-basic-tests' into jose-romero
Oct 16, 2013
4bbee80
add test to create method
Oct 16, 2013
98668cb
added vadilation of presece to transaction model in amount and accoun…
Oct 16, 2013
206e87e
added test to create method
Oct 16, 2013
aa3a64d
added tests to transactions controller in put method
Oct 16, 2013
9b2256b
uncommented require pocket_money
Oct 17, 2013
338aeea
ignored my database
Oct 17, 2013
2d2120e
reverted change in category_name
Oct 17, 2013
aa39197
comented code
Oct 18, 2013
3783baa
added database cleaner gem
elherzt Oct 21, 2013
b9b05ab
add validation for test enviroment
elherzt Oct 21, 2013
6d9f24f
ignored test database
elherzt Oct 21, 2013
a35bbd3
added test to import pocket money database
elherzt Oct 21, 2013
17fdfbc
added some test at import proccess
elherzt Oct 21, 2013
45eb3a6
added test
elherzt Oct 22, 2013
48f2bc6
deleted comented lines
elherzt Oct 22, 2013
113782e
moved database test at spec folder
elherzt Oct 22, 2013
9191fcc
uncommented line in transaction model
elherzt Oct 22, 2013
af5f927
added tests
elherzt Oct 22, 2013
3eedc88
deleted validation to test enviroment
elherzt Oct 22, 2013
31213e2
added more tests
elherzt Oct 22, 2013
583b96f
edited test
elherzt Oct 22, 2013
fc89d8b
added more tests and updated database test with repeating transactions
elherzt Oct 22, 2013
b29c521
added more tests
elherzt Oct 22, 2013
d8ae2be
added more test and refactored one test
elherzt Oct 22, 2013
8fbc322
refactored some tests
elherzt Oct 22, 2013
f78f9d5
refactored tests
elherzt Oct 23, 2013
973e2ab
changed test database
elherzt Oct 23, 2013
655a490
update expected values of current balance
elherzt Oct 23, 2013
998d0d0
moved before all method from pocket_money_spec to spec_helper
elherzt Oct 23, 2013
1271ef3
refactored proccess import to tests
elherzt Oct 23, 2013
e240cad
added shoulda matchers gem
elherzt Oct 23, 2013
e0e9e09
added some test
elherzt Oct 23, 2013
9e1245f
refactored test
elherzt Oct 23, 2013
5d69475
added some tests
elherzt Oct 23, 2013
47c3302
refactored test
elherzt Oct 23, 2013
89cda44
added more tests at transaction model
elherzt Oct 24, 2013
d48052b
updated database test in order to have cleared transactions
elherzt Oct 24, 2013
789609f
added more tests
elherzt Oct 24, 2013
75cfb3a
updated expected values in current balances of accounts
elherzt Oct 24, 2013
a321d19
added more tests
elherzt Oct 24, 2013
eb07298
deleted unecesary files
elherzt Oct 24, 2013
7173f81
refactored tests
elherzt Oct 24, 2013
f84f2fa
deleted scope uuid
elherzt Oct 24, 2013
263a935
deleted tests to uuid scope
elherzt Oct 24, 2013
3368a10
undeleted factories because are necesary to a one test
elherzt Oct 25, 2013
28f1ea3
deleted test
elherzt Oct 28, 2013
63d3b54
added first test on features folder
elherzt Oct 29, 2013
19c464a
added test for transactions per ccategories
elherzt Oct 30, 2013
9e62b7a
cretaed file to transaction type tests
elherzt Oct 30, 2013
ea9ee78
refactored tests
elherzt Oct 31, 2013
f573e18
add tests
elherzt Oct 31, 2013
3b586a1
added more tests
elherzt Oct 31, 2013
c476ea8
Merge remote-tracking branch 'origin/fix/sow-account' into feature/ad…
elherzt Oct 31, 2013
c39a473
added more tests
elherzt Oct 31, 2013
1c4a56d
refactored tests
elherzt Oct 31, 2013
b4e730a
refactored tests
elherzt Oct 31, 2013
d71c172
added test to active_transations scope
elherzt Nov 4, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
config/database.yml
config/config.yml


PocketMoneyDB.sql
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you would need to add the database on the text folder

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err TEST

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

**/.DS_Store
1 change: 1 addition & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--color
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ gem 'haml'
gem 'twitter-bootstrap-rails', :git => 'git://github.com/seyhunak/twitter-bootstrap-rails.git'
gem 'less-rails'
gem "therubyracer"
gem "faker"

group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
Expand All @@ -46,6 +47,16 @@ gem 'pry-rails'

gem 'ruby-progressbar'

group :test do
gem 'database_cleaner'
gem 'rspec'
gem 'rspec-rails'
gem 'capybara'
gem 'factory_girl'
gem 'factory_girl_rails'
gem 'shoulda-matchers'
end

# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

Expand Down
45 changes: 45 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ GEM
arel (4.0.0)
atomic (1.1.9)
builder (3.1.4)
capybara (2.1.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
coderay (1.0.9)
coffee-rails (4.0.0)
coffee-script (>= 2.2.0)
Expand All @@ -47,9 +53,18 @@ GEM
execjs
coffee-script-source (1.6.2)
commonjs (0.2.6)
database_cleaner (1.2.0)
diff-lcs (1.2.4)
erubis (2.7.0)
execjs (1.4.0)
multi_json (~> 1.0)
factory_girl (4.2.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.2.1)
factory_girl (~> 4.2.0)
railties (>= 3.0.0)
faker (1.2.0)
i18n (~> 0.5)
haml (4.0.3)
tilt
hike (1.2.2)
Expand All @@ -71,8 +86,11 @@ GEM
treetop (~> 1.4.8)
method_source (0.8.1)
mime-types (1.23)
mini_portile (0.5.1)
minitest (4.7.4)
multi_json (1.7.4)
nokogiri (1.6.0)
mini_portile (~> 0.5.0)
pg (0.15.1)
polyglot (0.3.3)
pry (0.9.12.2)
Expand Down Expand Up @@ -104,6 +122,21 @@ GEM
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.5)
rspec-expectations (2.14.3)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.14.3)
rspec-rails (2.14.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-progressbar (1.1.1)
sass (3.2.9)
sass-rails (4.0.0.rc1)
Expand All @@ -114,6 +147,8 @@ GEM
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
shoulda-matchers (2.4.0)
activesupport (>= 3.0.0)
slop (3.4.5)
sprockets (2.10.0)
hike (~> 1.2)
Expand Down Expand Up @@ -141,13 +176,20 @@ GEM
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)
xpath (2.0.0)
nokogiri (~> 1.3)
yard (0.8.7)

PLATFORMS
ruby

DEPENDENCIES
capybara
coffee-rails (~> 4.0.0)
database_cleaner
factory_girl
factory_girl_rails
faker
haml
jbuilder (~> 1.0.1)
jquery-rails
Expand All @@ -157,9 +199,12 @@ DEPENDENCIES
pry-doc
pry-rails
rails (= 4.0.0.rc1)
rspec
rspec-rails
ruby-progressbar
sass-rails (~> 4.0.0.rc1)
sdoc
shoulda-matchers
sqlite3
therubyracer
turbolinks
Expand Down
8 changes: 4 additions & 4 deletions app/models/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@ class Transaction < ActiveRecord::Base
# pm_types
# 0 Withdrawal
# 1 Deposit
# 2 Transfer
# 3
# 2 Transfer (-)
# 3 Transfer (+)
# 4
# 5 Dunno but removed it for now
#

scope :search, ->(q) { where "payee_name like ? OR uuid = ?", "%#{q}%", q }
scope :uuid, ->(uuid) { where(uuid:uuid).first }
scope :active, -> { where(deleted:false).where('transactions.pm_type <> 5') }
scope :order_date, -> { order('date desc') }
scope :cleared, -> { where(cleared:true) }
Expand All @@ -23,7 +22,8 @@ class Transaction < ActiveRecord::Base

belongs_to :account
has_many :splits

validates :account_id, presence: true
validates :amount, presence: true

def split?
@split ||= splits.size > 1
Expand Down
40 changes: 20 additions & 20 deletions app/views/transactions/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
<%= f.label :category_id %><br>
<%= f.number_field :category_id %>
</div>
<div class="field">
<%= f.label :class_id %><br>
<%= f.number_field :class_id %>
</div>
<div class="field">
<%= f.label :memo %><br>
<%= f.text_area :memo %>
</div>
<%#<div class="field">%>
<%#<%= f.label :class_id %><br>%>
<%#<%= f.number_field :class_id %>%>
<%#</div>%>
<%#<div class="field">%>
<%#<%= f.label :memo %><br>%>
<%#<%= f.text_area :memo %>%>
<%#</div>%>
<div class="field">
<%= f.label :amount %><br>
<%= f.text_field :amount %>
Expand All @@ -47,18 +47,18 @@
<%= f.label :cleared %><br>
<%= f.check_box :cleared %>
</div>
<div class="field">
<%= f.label :currency_id %><br>
<%= f.text_field :currency_id %>
</div>
<div class="field">
<%= f.label :currency_exchange_rate %><br>
<%= f.text_field :currency_exchange_rate %>
</div>
<div class="field">
<%= f.label :balance %><br>
<%= f.text_field :balance %>
</div>
<%#<div class="field">%>
<%#<%= f.label :currency_id %><br>%>
<%#<%= f.text_field :currency_id %>%>
<%#</div>%>
<%#<div class="field">%>
<%#<%= f.label :currency_exchange_rate %><br>%>
<%#<%= f.text_field :currency_exchange_rate %>%>
<%#</div>%>
<%#<div class="field">%>
<%#<%= f.label :balance %><br>%>
<%#<%= f.text_field :balance %>%>
<%#</div>%>
<div class="actions">
<%= f.submit %>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/transactions/_transaction.haml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
%td= link_to transaction.date.to_s(:short_date), transaction
%td= transaction.account.name
%td= transaction.payee_name
%td= transaction.category_name
%td= transaction.category_name
%td.currency= money transaction.amount

- if show_balance
Expand Down
22 changes: 0 additions & 22 deletions app/views/transactions/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
<%= @transaction.category_id %>
</p>

<p>
<strong>Class:</strong>
<%= @transaction.class_id %>
</p>

<p>
<strong>Memo:</strong>
<%= @transaction.memo %>
</p>

<p>
<strong>Amount:</strong>
Expand All @@ -45,20 +36,7 @@
<%= @transaction.cleared %>
</p>

<p>
<strong>Currency:</strong>
<%= @transaction.currency_id %>
</p>

<p>
<strong>Currency exchange rate:</strong>
<%= @transaction.currency_exchange_rate %>
</p>

<p>
<strong>Balance:</strong>
<%= @transaction.balance %>
</p>

<%= link_to 'Edit', edit_transaction_path(@transaction) %> |
<%= link_to 'Back', transactions_path %>
2 changes: 1 addition & 1 deletion db/migrate/20130531005809_create_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def change
t.integer :payee_id
t.integer :category_id
t.integer :department_id
t.decimal :amount
t.decimal :amount, :precision => 10, :scale => 2
t.boolean :cleared
t.string :uuid

Expand Down
5 changes: 1 addition & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

ActiveRecord::Schema.define(version: 20130718222102) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

create_table "accounts", force: true do |t|
t.boolean "deleted"
t.datetime "updated_at"
Expand Down Expand Up @@ -134,7 +131,7 @@
t.integer "payee_id"
t.integer "category_id"
t.integer "department_id"
t.decimal "amount"
t.decimal "amount", precision: 10, scale: 2
t.boolean "cleared"
t.string "uuid"
t.datetime "created_at"
Expand Down
Loading