financial 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. data/.gitignore +4 -0
  2. data/.infinity_test +16 -0
  3. data/.rspec +3 -0
  4. data/.rvmrc +1 -0
  5. data/Gemfile +15 -0
  6. data/Gemfile.lock +74 -0
  7. data/README.markdown +157 -0
  8. data/Rakefile +1 -0
  9. data/duck_tales.gif +0 -0
  10. data/example.png +0 -0
  11. data/examples/two_accounts.rb +32 -0
  12. data/features/portuguese_dsl.feature +93 -0
  13. data/features/print_financial_table.feature +318 -0
  14. data/features/support/env.rb +1 -0
  15. data/financial.gemspec +22 -0
  16. data/lib/financial.rb +39 -0
  17. data/lib/financial/account.rb +129 -0
  18. data/lib/financial/account_manager.rb +26 -0
  19. data/lib/financial/balance.rb +11 -0
  20. data/lib/financial/balance_calculation.rb +35 -0
  21. data/lib/financial/cost.rb +34 -0
  22. data/lib/financial/costs.rb +30 -0
  23. data/lib/financial/deposit.rb +30 -0
  24. data/lib/financial/deposits.rb +15 -0
  25. data/lib/financial/dsl.rb +16 -0
  26. data/lib/financial/financial_date.rb +18 -0
  27. data/lib/financial/financial_table.rb +109 -0
  28. data/lib/financial/locale.rb +153 -0
  29. data/lib/financial/locales/en.yml +34 -0
  30. data/lib/financial/locales/pt.yml +67 -0
  31. data/lib/financial/parcels.rb +87 -0
  32. data/lib/financial/per_cent.rb +12 -0
  33. data/lib/financial/print_table.rb +34 -0
  34. data/lib/financial/revenue.rb +40 -0
  35. data/lib/financial/revenues.rb +16 -0
  36. data/lib/financial/rspec_matchers.rb +32 -0
  37. data/lib/financial/tax.rb +4 -0
  38. data/lib/financial/version.rb +3 -0
  39. data/spec/financial/account_manager_spec.rb +38 -0
  40. data/spec/financial/account_spec.rb +399 -0
  41. data/spec/financial/balance_spec.rb +44 -0
  42. data/spec/financial/cost_spec.rb +78 -0
  43. data/spec/financial/costs_spec.rb +18 -0
  44. data/spec/financial/deposit_spec.rb +78 -0
  45. data/spec/financial/deposits_spec.rb +23 -0
  46. data/spec/financial/english_spec.rb +76 -0
  47. data/spec/financial/financial_date_spec.rb +50 -0
  48. data/spec/financial/financial_spec.rb +14 -0
  49. data/spec/financial/financial_table_spec.rb +31 -0
  50. data/spec/financial/locale_spec.rb +37 -0
  51. data/spec/financial/parcels_spec.rb +179 -0
  52. data/spec/financial/per_cent_spec.rb +24 -0
  53. data/spec/financial/portuguese_spec.rb +117 -0
  54. data/spec/financial/print_table_spec.rb +76 -0
  55. data/spec/financial/revenue_spec.rb +89 -0
  56. data/spec/financial/revenues_spec.rb +18 -0
  57. data/spec/financial/tax_spec.rb +42 -0
  58. data/spec/spec_helper.rb +25 -0
  59. metadata +139 -0
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+
3
+ module Financial
4
+ describe Revenues do
5
+ let(:revenues) { Revenues.new }
6
+ describe '#method_missing' do
7
+ it 'should create a cost when passing an argument' do
8
+ revenues.super_revenue(100).should be_instance_of(Revenue)
9
+ end
10
+
11
+ it 'should raise error when pass without argument' do
12
+ expect {
13
+ revenues.a_bill
14
+ }.to raise_error Financial::RevenueWithoutValue, "Revenue: a_bill don't have a value. Pass a value!"
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ module Financial
4
+ describe Tax do
5
+ let(:tax) { Tax.new(:billing, 500) }
6
+
7
+ describe '#name' do
8
+ it 'should return the name capitalized' do
9
+ tax.name.should == "Billing"
10
+ end
11
+ end
12
+
13
+ describe '#value' do
14
+ it 'should return the value' do
15
+ tax.value.should be 500
16
+ end
17
+ end
18
+
19
+ describe '#date' do
20
+ it 'should return the date of today' do
21
+ Tax.new(:billing, 400).date.should == Date.today
22
+ end
23
+ end
24
+
25
+ describe '#in_date' do
26
+ let(:billing) { Tax.new(:a_billing, 199) }
27
+ context 'when is in portuguese' do
28
+ it 'should get and set the day/month/year format' do
29
+ Financial.locale = :pt
30
+ billing.na_data('20/12/2011').date.should == Date.civil(2011, 12, 20)
31
+ end
32
+ end
33
+
34
+ context 'when is in english' do
35
+ it 'should get and set the month/day/year format' do
36
+ Financial.locale = :en
37
+ billing.in_date('12/20/2011').date.should == Date.civil(2011, 12, 20)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ require 'rspec'
2
+ require 'financial'
3
+
4
+ # require 'simplecov'
5
+ # SimpleCov.start
6
+
7
+ include Financial::DSL
8
+
9
+ RSpec.configure do |config|
10
+ include Financial::RSpecMatchers
11
+
12
+ def mock_date(day, month, year)
13
+ Date.should_receive(:today).at_least(:once).and_return(Date.civil(year, month, day))
14
+ end
15
+
16
+ def stub_date(day, month, year)
17
+ Date.stub!(:today).and_return(Date.civil(year, month, day))
18
+ end
19
+
20
+ def ensure_locale(locale_name)
21
+ Financial.locale = locale_name
22
+ Financial.locale.name.should equal locale_name
23
+ end
24
+
25
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: financial
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tomas D'Stefano
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-07-10 00:00:00.000000000 -03:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: terminal-table
17
+ requirement: &2161490520 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - =
21
+ - !ruby/object:Gem::Version
22
+ version: 1.4.2
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *2161490520
26
+ description: Manage your money in the terminal with A Ruby DSL
27
+ email:
28
+ - tomas_stefano@successoft.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - .gitignore
34
+ - .infinity_test
35
+ - .rspec
36
+ - .rvmrc
37
+ - Gemfile
38
+ - Gemfile.lock
39
+ - README.markdown
40
+ - Rakefile
41
+ - duck_tales.gif
42
+ - example.png
43
+ - examples/two_accounts.rb
44
+ - features/portuguese_dsl.feature
45
+ - features/print_financial_table.feature
46
+ - features/support/env.rb
47
+ - financial.gemspec
48
+ - lib/financial.rb
49
+ - lib/financial/account.rb
50
+ - lib/financial/account_manager.rb
51
+ - lib/financial/balance.rb
52
+ - lib/financial/balance_calculation.rb
53
+ - lib/financial/cost.rb
54
+ - lib/financial/costs.rb
55
+ - lib/financial/deposit.rb
56
+ - lib/financial/deposits.rb
57
+ - lib/financial/dsl.rb
58
+ - lib/financial/financial_date.rb
59
+ - lib/financial/financial_table.rb
60
+ - lib/financial/locale.rb
61
+ - lib/financial/locales/en.yml
62
+ - lib/financial/locales/pt.yml
63
+ - lib/financial/parcels.rb
64
+ - lib/financial/per_cent.rb
65
+ - lib/financial/print_table.rb
66
+ - lib/financial/revenue.rb
67
+ - lib/financial/revenues.rb
68
+ - lib/financial/rspec_matchers.rb
69
+ - lib/financial/tax.rb
70
+ - lib/financial/version.rb
71
+ - spec/financial/account_manager_spec.rb
72
+ - spec/financial/account_spec.rb
73
+ - spec/financial/balance_spec.rb
74
+ - spec/financial/cost_spec.rb
75
+ - spec/financial/costs_spec.rb
76
+ - spec/financial/deposit_spec.rb
77
+ - spec/financial/deposits_spec.rb
78
+ - spec/financial/english_spec.rb
79
+ - spec/financial/financial_date_spec.rb
80
+ - spec/financial/financial_spec.rb
81
+ - spec/financial/financial_table_spec.rb
82
+ - spec/financial/locale_spec.rb
83
+ - spec/financial/parcels_spec.rb
84
+ - spec/financial/per_cent_spec.rb
85
+ - spec/financial/portuguese_spec.rb
86
+ - spec/financial/print_table_spec.rb
87
+ - spec/financial/revenue_spec.rb
88
+ - spec/financial/revenues_spec.rb
89
+ - spec/financial/tax_spec.rb
90
+ - spec/spec_helper.rb
91
+ has_rdoc: true
92
+ homepage: https://github.com/tomas-stefano/financial
93
+ licenses: []
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ required_rubygems_version: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ requirements: []
111
+ rubyforge_project: financial
112
+ rubygems_version: 1.6.2
113
+ signing_key:
114
+ specification_version: 3
115
+ summary: Manage your money in the terminal with A Ruby DSL
116
+ test_files:
117
+ - features/portuguese_dsl.feature
118
+ - features/print_financial_table.feature
119
+ - features/support/env.rb
120
+ - spec/financial/account_manager_spec.rb
121
+ - spec/financial/account_spec.rb
122
+ - spec/financial/balance_spec.rb
123
+ - spec/financial/cost_spec.rb
124
+ - spec/financial/costs_spec.rb
125
+ - spec/financial/deposit_spec.rb
126
+ - spec/financial/deposits_spec.rb
127
+ - spec/financial/english_spec.rb
128
+ - spec/financial/financial_date_spec.rb
129
+ - spec/financial/financial_spec.rb
130
+ - spec/financial/financial_table_spec.rb
131
+ - spec/financial/locale_spec.rb
132
+ - spec/financial/parcels_spec.rb
133
+ - spec/financial/per_cent_spec.rb
134
+ - spec/financial/portuguese_spec.rb
135
+ - spec/financial/print_table_spec.rb
136
+ - spec/financial/revenue_spec.rb
137
+ - spec/financial/revenues_spec.rb
138
+ - spec/financial/tax_spec.rb
139
+ - spec/spec_helper.rb