uomi 0.2.14 → 0.2.15

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ group :development do
7
7
  gem 'rspec'
8
8
  gem 'rspec-rails'
9
9
  gem 'sqlite3'
10
+ gem 'database_cleaner', '>= 1.2.0'
10
11
  end
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- [![Build Status](https://secure.travis-ci.org/tehtorq/uomi.png)](http://travis-ci.org/tehtorq/uomi)
2
+ [![Build Status](https://secure.travis-ci.org/tehtorq/invoicing.png)](http://travis-ci.org/tehtorq/invoicing)
3
3
 
4
4
  Basic Usage
5
5
 
@@ -1,7 +1,6 @@
1
1
  module Uomi
2
2
  class LatePayment < ActiveRecord::Base
3
3
  belongs_to :invoice
4
-
5
4
  before_create :set_penalty_date
6
5
 
7
6
  def set_penalty_date
@@ -4,7 +4,7 @@ module Uomi
4
4
  belongs_to :invoiceable, polymorphic: true
5
5
  belongs_to :line_item_type
6
6
 
7
- validates :amount, numericality: {greater_than_or_equal_to: 0}, presence: true
7
+ validates :amount, numericality: true, presence: true
8
8
 
9
9
  def net_amount
10
10
  amount - tax
@@ -1,6 +1,5 @@
1
1
  module Uomi
2
2
  class LineItemType < ActiveRecord::Base
3
3
  has_many :line_items
4
-
5
4
  end
6
5
  end
@@ -1,3 +1,3 @@
1
1
  module Uomi
2
- VERSION = "0.2.14"
2
+ VERSION = "0.2.15"
3
3
  end
@@ -1,11 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Uomi::CreditNote do
4
- include Helpers
5
4
 
6
5
  before(:each) do
7
- tear_it_down
8
-
9
6
  invoice_buyer = Uomi::DebitTransaction.create!
10
7
  invoice_seller = Uomi::DebitTransaction.create!
11
8
 
@@ -1,11 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Uomi::InvoiceAdjustment do
4
- include Helpers
5
4
 
6
5
  before(:each) do
7
- tear_it_down
8
-
9
6
  buyer = Uomi::DebitTransaction.create!
10
7
 
11
8
  @invoice = Uomi::generate_invoice do
@@ -1,11 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Uomi::Invoice do
4
- include Helpers
5
4
 
6
5
  before(:each) do
7
- tear_it_down
8
-
9
6
  @invoice = Uomi::generate_invoice do
10
7
  line_item description: "Line Item 1", amount: 1101, line_item_type_id: 1
11
8
  line_item description: "Line Item 2", amount: 5097, line_item_type_id: 1
@@ -76,10 +73,6 @@ describe Uomi::Invoice do
76
73
 
77
74
  context "searching for sets of invoices" do
78
75
 
79
- before(:each) do
80
- tear_it_down
81
- end
82
-
83
76
  it "should find draft invoices" do
84
77
  issued_invoice = Uomi::generate_invoice do
85
78
  line_item description: "Line Item 1", amount: 1101, line_item_type_id: 1
@@ -91,8 +84,8 @@ describe Uomi::Invoice do
91
84
  line_item description: "Line Item 1", amount: 1101, line_item_type_id: 1, line_item_type_id: 1
92
85
  end
93
86
 
94
- Uomi::Invoice.draft.count.should == 1
95
- Uomi::Invoice.draft.first.should == draft_invoice
87
+ Uomi::Invoice.draft.count.should == 2
88
+ Uomi::Invoice.draft.last.should == draft_invoice
96
89
  end
97
90
 
98
91
  it "should find issued invoices" do
@@ -385,6 +378,7 @@ describe Uomi::Invoice do
385
378
  end
386
379
 
387
380
  context "Hooks" do
381
+
388
382
  before(:each) do
389
383
  item_to_invoice = @invoice.extend(Uomi::Invoiceable)
390
384
  item_to_invoice.amount = 10
@@ -397,18 +391,21 @@ describe Uomi::Invoice do
397
391
  end
398
392
 
399
393
  context "issuing the invoice" do
400
- it "the items to invoice should receive a mark invoice call" do
394
+
395
+ it "calls mark_invoiced on each invoiced item" do
401
396
  @item_to_invoice.should_receive(:mark_invoiced).with(@invoice2)
402
397
  @invoice2.issue!
403
398
  end
399
+
404
400
  end
405
401
 
406
402
  context "voiding the issued invoice" do
403
+
407
404
  before(:each) do
408
405
  @invoice2.issue!
409
406
  end
410
407
 
411
- it "the items to invoice should receive a mark uninvoiced call" do
408
+ it "calls mark_uninvoiced on each invoiced item" do
412
409
  @item_to_invoice.should_receive(:mark_uninvoiced).with(@invoice2)
413
410
  @invoice2.void!
414
411
  end
@@ -1,10 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Uomi::LineItem do
4
- include Helpers
5
4
 
6
- it "should validate that the amount is positive" do
7
- expect {Uomi::LineItem.create! amount: -0.01}.to raise_error ActiveRecord::RecordInvalid, "Validation failed: Amount must be greater than or equal to 0"
5
+ it "should validate that the amount is numeric" do
6
+ expect {Uomi::LineItem.create! amount: "fifty bucks"}.to raise_error ActiveRecord::RecordInvalid, "Validation failed: Amount is not a number"
8
7
  end
9
8
 
10
9
  it "should validate that the amount is specified" do
@@ -1,11 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Uomi::OverdueInvoice do
4
- include Helpers
5
-
6
- before(:each) do
7
- tear_it_down
8
- end
9
4
 
10
5
  it "should find all invoices which are overdue" do
11
6
  Uomi::generate_invoice do
@@ -1,4 +1,3 @@
1
-
2
1
  require 'rubygems'
3
2
  require 'bundler'
4
3
 
@@ -8,13 +7,17 @@ Combustion.initialize! :active_record
8
7
 
9
8
  require 'rspec/rails'
10
9
 
11
- require './spec/support/helpers.rb'
12
-
13
10
  RSpec.configure do |config|
14
11
  config.use_transactional_fixtures = true
15
12
  config.color_enabled = true
16
- config.formatter = :documentation # :progress, :html, :textmate
17
- #config.include FactoryGirl::Syntax::Methods
18
- end
13
+ config.formatter = :documentation
19
14
 
20
- #FactoryGirl.find_definitions
15
+ config.before(:suite) do
16
+ DatabaseCleaner.strategy = :truncation
17
+ end
18
+
19
+ config.before(:each) do
20
+ DatabaseCleaner.clean
21
+ end
22
+
23
+ end
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = Uomi::VERSION
8
8
  s.authors = ["Douglas Anderson", "Jeffrey van Aswegen"]
9
9
  s.email = ["i.am.douglas.anderson@gmail.com", "jeffmess@gmail.com"]
10
- s.homepage = 'https://github.com/tehtorq/uomi'
10
+ s.homepage = 'https://github.com/tehtorq/invoicing'
11
11
  s.summary = %q{ An uomi gem. }
12
12
  s.description = %q{ Manage invoices. }
13
13
 
@@ -24,4 +24,5 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency "workflow", '= 0.8.7'
25
25
 
26
26
  s.add_development_dependency 'combustion', '~> 0.3.1'
27
+ s.add_development_dependency 'database_cleaner', '~> 1.2.0'
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uomi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-19 00:00:00.000000000 Z
13
+ date: 2014-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -92,6 +92,22 @@ dependencies:
92
92
  - - ~>
93
93
  - !ruby/object:Gem::Version
94
94
  version: 0.3.1
95
+ - !ruby/object:Gem::Dependency
96
+ name: database_cleaner
97
+ requirement: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ~>
101
+ - !ruby/object:Gem::Version
102
+ version: 1.2.0
103
+ type: :development
104
+ prerelease: false
105
+ version_requirements: !ruby/object:Gem::Requirement
106
+ none: false
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 1.2.0
95
111
  description: ! ' Manage invoices. '
96
112
  email:
97
113
  - i.am.douglas.anderson@gmail.com
@@ -137,14 +153,12 @@ files:
137
153
  - spec/internal/public/favicon.ico
138
154
  - spec/lib/uomi/credit_note_spec.rb
139
155
  - spec/lib/uomi/invoice_adjustment_spec.rb
140
- - spec/lib/uomi/invoice_late_payment_spec.rb
141
156
  - spec/lib/uomi/invoice_spec.rb
142
157
  - spec/lib/uomi/line_item_spec.rb
143
158
  - spec/lib/uomi/overdue_invoice_spec.rb
144
159
  - spec/spec_helper.rb
145
- - spec/support/helpers.rb
146
160
  - uomi.gemspec
147
- homepage: https://github.com/tehtorq/uomi
161
+ homepage: https://github.com/tehtorq/invoicing
148
162
  licenses: []
149
163
  post_install_message:
150
164
  rdoc_options: []
@@ -177,9 +191,7 @@ test_files:
177
191
  - spec/internal/public/favicon.ico
178
192
  - spec/lib/uomi/credit_note_spec.rb
179
193
  - spec/lib/uomi/invoice_adjustment_spec.rb
180
- - spec/lib/uomi/invoice_late_payment_spec.rb
181
194
  - spec/lib/uomi/invoice_spec.rb
182
195
  - spec/lib/uomi/line_item_spec.rb
183
196
  - spec/lib/uomi/overdue_invoice_spec.rb
184
197
  - spec/spec_helper.rb
185
- - spec/support/helpers.rb
@@ -1,10 +0,0 @@
1
- # require 'spec_helper'
2
- #
3
- # describe Uomi::LatePayment do
4
- # include Helpers
5
- #
6
- # before(:each) do
7
- # tear_it_down
8
- # end
9
- #
10
- # end
@@ -1,20 +0,0 @@
1
- module Helpers
2
- def tear_it_down
3
- Uomi::Invoice.delete_all
4
- Uomi::LineItem.delete_all
5
- Uomi::Transaction.delete_all
6
- Uomi::LatePayment.delete_all
7
- Uomi::PaymentReference.delete_all
8
- Uomi::Seller.delete_all
9
- end
10
- end
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-