Permalink
Browse files

Remove deprecation warnings in test

  • Loading branch information...
francho committed Jun 6, 2016
1 parent b06d4ff commit 37a15950189af3d6054ba6d2c9588cb250f4c51e
Showing with 108 additions and 108 deletions.
  1. +108 −108 gilded_rose_spec.rb
View
@@ -1,218 +1,218 @@
require 'rspec/given'
require 'gilded_rose'
describe "#update_quality" do
describe '#update_quality' do
context "with a single" do
context 'with a single' do
Given(:initial_sell_in) { 5 }
Given(:initial_quality) { 10 }
Given(:item) { Item.new(name, initial_sell_in, initial_quality) }
When { update_quality([item]) }
context "normal item" do
Given(:name) { "NORMAL ITEM" }
context 'normal item' do
Given(:name) { 'NORMAL ITEM' }
Invariant { item.sell_in.should == initial_sell_in-1 }
Invariant { expect(item.sell_in).to eq(initial_sell_in-1) }
context "before sell date" do
Then { item.quality.should == initial_quality-1 }
context 'before sell date' do
Then { expect(item.quality).to eq(initial_quality-1) }
end
context "on sell date" do
context 'on sell date' do
Given(:initial_sell_in) { 0 }
Then { item.quality.should == initial_quality-2 }
Then { expect(item.quality).to eq(initial_quality-2) }
end
context "after sell date" do
context 'after sell date' do
Given(:initial_sell_in) { -10 }
Then { item.quality.should == initial_quality-2 }
Then { expect(item.quality).to eq(initial_quality-2) }
end
context "of zero quality" do
context 'of zero quality' do
Given(:initial_quality) { 0 }
Then { item.quality.should == 0 }
Then { expect(item.quality).to eq(0) }
end
end
context "Aged Brie" do
Given(:name) { "Aged Brie" }
context 'Aged Brie' do
Given(:name) { 'Aged Brie' }
Invariant { item.sell_in.should == initial_sell_in-1 }
Invariant { expect(item.sell_in).to eq(initial_sell_in-1) }
context "before sell date" do
Then { item.quality.should == initial_quality+1 }
context 'before sell date' do
Then { expect(item.quality).to eq(initial_quality+1) }
context "with max quality" do
context 'with max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "on sell date" do
context 'on sell date' do
Given(:initial_sell_in) { 0 }
Then { item.quality.should == initial_quality+2 }
Then { expect(item.quality).to eq(initial_quality+2) }
context "near max quality" do
context 'near max quality' do
Given(:initial_quality) { 49 }
Then { item.quality.should == 50 }
Then { expect(item.quality).to eq(50) }
end
context "with max quality" do
context 'with max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "after sell date" do
context 'after sell date' do
Given(:initial_sell_in) { -10 }
Then { item.quality.should == initial_quality+2 }
Then { expect(item.quality).to eq(initial_quality+2) }
context "with max quality" do
context 'with max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
end
context "Sulfuras" do
context 'Sulfuras' do
Given(:initial_quality) { 80 }
Given(:name) { "Sulfuras, Hand of Ragnaros" }
Given(:name) { 'Sulfuras, Hand of Ragnaros' }
Invariant { item.sell_in.should == initial_sell_in }
Invariant { expect(item.sell_in).to eq(initial_sell_in) }
context "before sell date" do
Then { item.quality.should == initial_quality }
context 'before sell date' do
Then { expect(item.quality).to eq(initial_quality) }
end
context "on sell date" do
context 'on sell date' do
Given(:initial_sell_in) { 0 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
context "after sell date" do
context 'after sell date' do
Given(:initial_sell_in) { -10 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "Backstage pass" do
Given(:name) { "Backstage passes to a TAFKAL80ETC concert" }
context 'Backstage pass' do
Given(:name) { 'Backstage passes to a TAFKAL80ETC concert' }
Invariant { item.sell_in.should == initial_sell_in-1 }
Invariant { expect(item.sell_in).to eq(initial_sell_in-1) }
context "long before sell date" do
context 'long before sell date' do
Given(:initial_sell_in) { 11 }
Then { item.quality.should == initial_quality+1 }
Then { expect(item.quality).to eq(initial_quality+1) }
context "at max quality" do
context 'at max quality' do
Given(:initial_quality) { 50 }
end
end
context "medium close to sell date (upper bound)" do
context 'medium close to sell date (upper bound)' do
Given(:initial_sell_in) { 10 }
Then { item.quality.should == initial_quality+2 }
Then { expect(item.quality).to eq(initial_quality+2) }
context "at max quality" do
context 'at max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "medium close to sell date (lower bound)" do
context 'medium close to sell date (lower bound)' do
Given(:initial_sell_in) { 6 }
Then { item.quality.should == initial_quality+2 }
Then { expect(item.quality).to eq(initial_quality+2) }
context "at max quality" do
context 'at max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "very close to sell date (upper bound)" do
context 'very close to sell date (upper bound)' do
Given(:initial_sell_in) { 5 }
Then { item.quality.should == initial_quality+3 }
Then { expect(item.quality).to eq(initial_quality+3) }
context "at max quality" do
context 'at max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "very close to sell date (lower bound)" do
context 'very close to sell date (lower bound)' do
Given(:initial_sell_in) { 1 }
Then { item.quality.should == initial_quality+3 }
Then { expect(item.quality).to eq(initial_quality+3) }
context "at max quality" do
context 'at max quality' do
Given(:initial_quality) { 50 }
Then { item.quality.should == initial_quality }
Then { expect(item.quality).to eq(initial_quality) }
end
end
context "on sell date" do
context 'on sell date' do
Given(:initial_sell_in) { 0 }
Then { item.quality.should == 0 }
Then { expect(item.quality).to eq(0) }
end
context "after sell date" do
context 'after sell date' do
Given(:initial_sell_in) { -10 }
Then { item.quality.should == 0 }
Then { expect(item.quality).to eq(0) }
end
end
context "conjured item" do
before { pending }
Given(:name) { "Conjured Mana Cake" }
Invariant { item.sell_in.should == initial_sell_in-1 }
context "before the sell date" do
Given(:initial_sell_in) { 5 }
Then { item.quality.should == initial_quality-2 }
context "at zero quality" do
Given(:initial_quality) { 0 }
Then { item.quality.should == initial_quality }
end
end
context "on sell date" do
Given(:initial_sell_in) { 0 }
Then { item.quality.should == initial_quality-4 }
context "at zero quality" do
Given(:initial_quality) { 0 }
Then { item.quality.should == initial_quality }
end
end
context "after sell date" do
Given(:initial_sell_in) { -10 }
Then { item.quality.should == initial_quality-4 }
context "at zero quality" do
Given(:initial_quality) { 0 }
Then { item.quality.should == initial_quality }
end
end
end
# context 'conjured item' do
# before { pending }
# Given(:name) { 'Conjured Mana Cake' }
# Invariant { item.sell_in.should == initial_sell_in-1 }
# context 'before the sell date' do
# Given(:initial_sell_in) { 5 }
# Then { item.quality.should == initial_quality-2 }
# context 'at zero quality' do
# Given(:initial_quality) { 0 }
# Then { item.quality.should == initial_quality }
# end
# end
# context 'on sell date' do
# Given(:initial_sell_in) { 0 }
# Then { item.quality.should == initial_quality-4 }
# context 'at zero quality' do
# Given(:initial_quality) { 0 }
# Then { item.quality.should == initial_quality }
# end
# end
# context 'after sell date' do
# Given(:initial_sell_in) { -10 }
# Then { item.quality.should == initial_quality-4 }
# context 'at zero quality' do
# Given(:initial_quality) { 0 }
# Then { item.quality.should == initial_quality }
# end
# end
# end
end
context "with several objects" do
context 'with several objects' do
Given(:items) {
[
Item.new("NORMAL ITEM", 5, 10),
Item.new("Aged Brie", 3, 10),
Item.new('NORMAL ITEM', 5, 10),
Item.new('Aged Brie', 3, 10),
]
}
When { update_quality(items) }
Then { items[0].quality.should == 9 }
Then { items[0].sell_in.should == 4 }
Then { expect(items[0].quality).to eq(9) }
Then { expect(items[0].sell_in).to eq(4) }
Then { items[1].quality.should == 11 }
Then { items[1].sell_in.should == 2 }
Then { expect(items[1].quality).to eq(11) }
Then { expect(items[1].sell_in).to eq(2) }
end
end

0 comments on commit 37a1595

Please sign in to comment.