mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-15 22:41:30 +00:00
Add error cases.
This commit is contained in:
parent
6b60a85ce9
commit
fbb8b8ad61
@ -2,8 +2,12 @@ require File.join(File.dirname(__FILE__), "gilded_rose")
|
||||
|
||||
describe GildedRose do
|
||||
describe "#update_quality" do
|
||||
def updated_items(items)
|
||||
def update_items(items)
|
||||
GildedRose.new(items).update_quality
|
||||
end
|
||||
|
||||
def updated_items(items)
|
||||
update_items(items)
|
||||
items
|
||||
end
|
||||
|
||||
@ -201,5 +205,13 @@ describe GildedRose do
|
||||
expect(items[0].sell_in).to eq(-1)
|
||||
end
|
||||
end
|
||||
|
||||
context "when process nil" do
|
||||
it { expect { update_items(nil) }.to raise_error }
|
||||
end
|
||||
|
||||
context "when process an array which contains nil" do
|
||||
it { expect { update_items([nil]) }.to raise_error }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user