Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test/backstage passes incrementa calidad #567

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 81 additions & 1 deletion ruby/gilded_rose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,86 @@
it "does not change the name" do
items = [Item.new("foo", 0, 0)]
GildedRose.new(items).update_quality()
expect(items[0].name).to eq "fixme"
expect(items[0].name).to eq "foo"
end

context 'para items normales' do
before do
## Arrange
@items = [Item.new("foo", 10, 2)]
@gilded = GildedRose.new(@items)
end


it 'decrementa la calidad del item' do
#Act
@gilded.update_quality()

#Assert
expect(@items[0].quality).to eq 1
end

it 'decrementa los dias para vender el item' do
#Act
@gilded.update_quality()

#Assert
expect(@items[0].sell_in).to eq 9
end

it 'decrementa la calidad del item al doble de velocidad cuando ya no quedan dias para venderlo' do
@items[0].sell_in = 0
@items[0].quality = 20

@gilded.update_quality()

expect(@items[0].quality).to eq 18
end

it 'no decrementa la calidad del item a negativo' do
@items[0].quality = 0

@gilded.update_quality()

expect(@items[0].quality).to eq 0
end
end

context 'para items Aged Brie' do
it 'incrementa su calidad'

it 'incrementa su calidad en 2 cuando ya no quedan dias de venta'

it 'no incrementa su calidad por sobre 50'
end

context 'para items Sulfuras' do
it 'no cambia su calidad'

it 'no cambia los dias para venderlo'
end

context 'para items Backstage Pass' do
it 'incrementa su calidad si quedan más de 10 días para venderlo'

it 'incrementa su calidad en 2 si quedan 10 dias o menos para venderlo' do
# arrange
@items = [Item.new("Backstage passes to a TAFKAL80ETC concert", 10, 2)]
@gilded = GildedRose.new(@items)

# act
@gilded.update_quality()

# expect
expect(@items[0].quality).to eq 4
end

it 'incrementa su calidad en 3 si quedan 5 dias o menos para venderlo'

it 'decrementa su calidad a 0 si ya no quedan dias para venderlo'
end

context 'para items conjurados' do
it 'decrementa su calidad en 2'
end
end