mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2026-02-04 09:11:39 +00:00
updated edge cases in test files
This commit is contained in:
parent
9d1928e5e2
commit
87e523a53b
@ -37,12 +37,17 @@ describe GildedRose do
|
||||
it "checks for quality to never be less than 0" do
|
||||
update_and_check_item(item_name: "+5 Dexterity Vest", initial_sell_in: 10, initial_quant: 0, output: "+5 Dexterity Vest, 9, 0")
|
||||
end
|
||||
|
||||
it "when sell_in value is negative" do
|
||||
update_and_check_item(item_name: "+5 Dexterity Vest", initial_sell_in: -1, initial_quant: 8, output: "+5 Dexterity Vest, -2, 6")
|
||||
end
|
||||
end
|
||||
|
||||
context "Sulfuras, Hand of Ragnaros" do
|
||||
it "never changes it's sell_in value and quantity" do
|
||||
update_and_check_item(item_name: "Sulfuras, Hand of Ragnaros", initial_sell_in: 0, initial_quant: 80, output: "Sulfuras, Hand of Ragnaros, 0, 80")
|
||||
update_and_check_item(item_name: "Sulfuras, Hand of Ragnaros", initial_sell_in: -1, initial_quant: 80, output: "Sulfuras, Hand of Ragnaros, -1, 80")
|
||||
update_and_check_item(item_name: "Sulfuras, Hand of Ragnaros", initial_sell_in: 1, initial_quant: 80, output: "Sulfuras, Hand of Ragnaros, 1, 80")
|
||||
end
|
||||
end
|
||||
|
||||
@ -58,6 +63,10 @@ describe GildedRose do
|
||||
it "checks for quality to never be more than 50" do
|
||||
update_and_check_item(item_name: "Aged Brie", initial_sell_in: 10, initial_quant: 50, output: "Aged Brie, 9, 50")
|
||||
end
|
||||
|
||||
it "when sell_in value is negative" do
|
||||
update_and_check_item(item_name: "Aged Brie", initial_sell_in: -1, initial_quant: 20, output: "Aged Brie, -2, 22")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -79,7 +88,11 @@ describe GildedRose do
|
||||
end
|
||||
|
||||
it "quality should not be greater than 50" do
|
||||
update_and_check_item(item_name: "Backstage passes to a TAFKAL80ETC concert", initial_sell_in: 10, initial_quant: 49, output: "Backstage passes to a TAFKAL80ETC concert, 9, 50")
|
||||
update_and_check_item(item_name: "Backstage passes to a TAFKAL80ETC concert", initial_sell_in: 10, initial_quant: 50, output: "Backstage passes to a TAFKAL80ETC concert, 9, 50")
|
||||
end
|
||||
|
||||
it "when sell_in value is negative then quality should be zero" do
|
||||
update_and_check_item(item_name: "Backstage passes to a TAFKAL80ETC concert", initial_sell_in: -1, initial_quant: 0, output: "Backstage passes to a TAFKAL80ETC concert, -2, 0")
|
||||
end
|
||||
|
||||
context "Conjured Items" do
|
||||
@ -92,7 +105,11 @@ describe GildedRose do
|
||||
end
|
||||
|
||||
it "does not decrease quality below 0" do
|
||||
update_and_check_item(item_name: "Conjured Mana Cake", initial_sell_in: 5, initial_quant: 1, output: "Conjured Mana Cake, 4, 0")
|
||||
update_and_check_item(item_name: "Conjured Mana Cake", initial_sell_in: 5, initial_quant: 0, output: "Conjured Mana Cake, 4, 0")
|
||||
end
|
||||
|
||||
it "when sell_in value is negative" do
|
||||
update_and_check_item(item_name: "Conjured Mana Cake", initial_sell_in: -1, initial_quant: 5, output: "Conjured Mana Cake, -2, 1")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,11 +7,14 @@ items = [
|
||||
Item.new(name="+5 Dexterity Vest", sell_in=10, quality=20),
|
||||
Item.new(name="+5 Dexterity Vest", sell_in=0, quality=20),
|
||||
Item.new(name="+5 Dexterity Vest", sell_in=0, quality=0),
|
||||
Item.new(name="+5 Dexterity Vest", sell_in=-1, quality=8),
|
||||
Item.new(name="Aged Brie", sell_in=2, quality=0),
|
||||
Item.new(name="Aged Brie", sell_in=0, quality=9),
|
||||
Item.new(name="Aged Brie", sell_in=2, quality=49),
|
||||
Item.new(name="Aged Brie", sell_in=2, quality=50),
|
||||
Item.new(name="Aged Brie", sell_in=-1, quality=20),
|
||||
Item.new(name="Elixir of the Mongoose", sell_in=5, quality=7),
|
||||
Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80),
|
||||
Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=0, quality=80),
|
||||
Item.new(name="Sulfuras, Hand of Ragnaros", sell_in=-1, quality=80),
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=15, quality=20),
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=49),
|
||||
@ -19,9 +22,11 @@ items = [
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=10, quality=45),
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=5, quality=40),
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=0, quality=3),
|
||||
Item.new(name="Backstage passes to a TAFKAL80ETC concert", sell_in=-1, quality=3),
|
||||
Item.new(name="Conjured Mana Cake", sell_in=3, quality=6),
|
||||
Item.new(name="Conjured Mana Cake", sell_in=0, quality=6),
|
||||
Item.new(name="Conjured Mana Cake", sell_in=5, quality=1),
|
||||
Item.new(name="Conjured Mana Cake", sell_in=-1, quality=5)
|
||||
]
|
||||
|
||||
days = 2
|
||||
|
||||
Loading…
Reference in New Issue
Block a user