-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e7df573
commit f232c0b
Showing
9 changed files
with
119 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Invoice class | ||
class Invoice | ||
attr_reader :printorder | ||
|
||
def initialize | ||
@printorder = [] | ||
end | ||
|
||
def print_order(order) | ||
puts "Customer Invoice \n" | ||
puts "Items rounded up to nearest available qty\n" | ||
puts "qty\titem\t\t\tsub" | ||
puts '-------------------------------------' | ||
order.items.each do |item| | ||
puts "#{item[0].order_qty} #{item[0].order_item.name} \t\t\t#{item[0].presenter_line_total}" | ||
item[1].each { |i| puts "\t#{i}\n" } | ||
end | ||
puts '-------------------------------------' | ||
puts "TOTAL \t\t\t\t#{order.find_order_total} \n\n" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'rspec' | ||
require 'spec_helper' | ||
require './lib/invoice' | ||
|
||
describe Invoice do | ||
describe '#initialize' do | ||
it 'should have a printorder attribute which is an Array' do | ||
instance = Invoice.new | ||
|
||
expect(instance.printorder).to be_a Array | ||
end | ||
end | ||
|
||
describe '#print_order' do | ||
it 'should return nil' do | ||
instance = Invoice.new | ||
|
||
expect(instance.print_order(Order.new)).to be_nil | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters