|
3 | 3 | from gilded_rose.inn import GildedRose, Item |
4 | 4 | from tests.builder import an_item |
5 | 5 |
|
6 | | -AGED_BRIE = "Aged Brie" |
7 | | - |
8 | 6 |
|
9 | 7 | def test_quality_degrades_over_time(): |
10 | 8 | """Test that the quality of an item decreases over time.""" |
@@ -60,7 +58,7 @@ def test_quality_cannot_get_negative(): |
60 | 58 | def test_aged_brie_ennobles_quality_over_time(): |
61 | 59 | """Test that the quality of Aged Brie increases over time.""" |
62 | 60 | # Arrange |
63 | | - items = [Item(AGED_BRIE, sell_in=10, quality=20)] |
| 61 | + items = [an_item().ennobling().sell_in(10).with_quality(20).build()] |
64 | 62 | gilded_rose = GildedRose(items) |
65 | 63 |
|
66 | 64 | # Act |
@@ -178,11 +176,37 @@ def test_conjured_items_degrade_twice_as_fast(): |
178 | 176 | def test_conjured_items_degrade_4_times_as_fast_after_sell_in_date_is_passed(): |
179 | 177 | """Test that the quality of conjured items degrades four times as fast after the sell-in date.""" |
180 | 178 | # Arrange |
181 | | - items = [Item("Conjured Mana Cake", sell_in=0, quality=6)] |
| 179 | + items = [an_item().conjured().expired().with_quality(6).build()] |
182 | 180 | gilded_rose = GildedRose(items) |
183 | 181 |
|
184 | 182 | # Act |
185 | 183 | gilded_rose.update_quality() |
186 | 184 |
|
187 | 185 | # Assert |
188 | 186 | assert gilded_rose.items[0].quality == 2 |
| 187 | + |
| 188 | + |
| 189 | +def test_conjured_ennobling_items_ennobles_twice_as_fast(): |
| 190 | + """Test that conjured ennobling items increase quality twice as fast.""" |
| 191 | + # Arrange |
| 192 | + items = [an_item().conjured().ennobling().sell_in(10).with_quality(20).build()] |
| 193 | + gilded_rose = GildedRose(items) |
| 194 | + |
| 195 | + # Act |
| 196 | + gilded_rose.update_quality() |
| 197 | + |
| 198 | + # Assert |
| 199 | + assert gilded_rose.items[0].quality == 22 |
| 200 | + |
| 201 | + |
| 202 | +def test_conjured_ennobling_items_ennobles_four_times_as_fast_after_sell_in_date_is_passed(): |
| 203 | + """Test that conjured ennobling items increase quality four times as fast after the sell-in date.""" |
| 204 | + # Arrange |
| 205 | + items = [an_item().conjured().ennobling().expired().with_quality(20).build()] |
| 206 | + gilded_rose = GildedRose(items) |
| 207 | + |
| 208 | + # Act |
| 209 | + gilded_rose.update_quality() |
| 210 | + |
| 211 | + # Assert |
| 212 | + assert gilded_rose.items[0].quality == 24 |
0 commit comments