updated these versions to more closely match the original C#

This commit is contained in:
Emily Bache committed 2013-03-13 18:20:38 +01:00
1 parent 2e3386ab13
commit 4dab932c94
4 files changed
+44 -37

No files matched your search

+7 -4
View File
@@ -1,7 +1,11 @@
class GildedRose
def update_quality(items)
items.each do |item|
def initialize(items)
@items = items
end
def update_quality()
@items.each do |item|
if item.name != "Aged Brie" and item.name != "Backstage passes to a TAFKAL80ETC concert"
if item.quality > 0
if item.name != "Sulfuras, Hand of Ragnaros"
@@ -46,7 +50,6 @@ class GildedRose
end
end
end
items
end
end
@@ -62,4 +65,4 @@ class Item
def to_s()
"#{@name}, #{@sell_in}, #{@quality}"
end
end
end
+1 -1
View File
@@ -5,7 +5,7 @@ describe GildedRose do
describe "#update_quality" do
it "does not change the name" do
items = [Item.new("foo", 0, 0)]
GildedRose.new().update_quality(items)
GildedRose.new(items).update_quality()
items[0].name.should == "fixme"
end
end