fix price history spec

This commit is contained in:
wvengen 2013-07-25 00:01:58 +02:00
parent d602b7cd0d
commit ebf71ad494

View file

@ -32,13 +32,12 @@ describe Article do
end end
it 'keeps a price history' do it 'keeps a price history' do
expect(article.article_prices.count).to eq(1) expect(article.article_prices.all.map(&:price)).to eq([article.price])
oldprice = article.price oldprice = article.price
sleep 1 # so that the new price really has a later creation time
article.price += 1 article.price += 1
article.save! article.save!
expect(article.article_prices.count).to eq(2) expect(article.article_prices.all.map(&:price)).to eq([article.price, oldprice])
expect(article.article_prices[0].price).to eq(article.price)
expect(article.article_prices[-1].price).to eq(oldprice)
end end
end end