Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Define oder_line, map out input options
- Loading branch information
1 parent
925b83c
commit ffba141
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
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,9 @@ | ||
# OrderLine class | ||
class OrderLine | ||
attr_reader :order_qty, :order_item | ||
|
||
def initialize(order_qty, order_item) | ||
@order_qty = order_qty | ||
@order_item = order_item | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
require 'rspec' | ||
require 'spec_helper' | ||
require './lib/order_line' | ||
|
||
describe OrderLine do | ||
describe '#initialize' do | ||
it 'should have a order_qty attribute which is an Integer' do | ||
instance = OrderLine.new(3, 'watermelon') | ||
|
||
expect(instance.order_qty).to be_a Integer | ||
expect(instance.order_qty).to eq 3 | ||
end | ||
|
||
it 'should have a order_item attribute which is an instance of Item' do | ||
instance = OrderLine.new(3, Watermelon.new('watermelon')) | ||
|
||
expect(instance.order_item).to be_a Item | ||
end | ||
end | ||
end |