fix price history spec

This commit is contained in:
wvengen 2013-07-25 00:01:58 +02:00
parent d602b7cd0d
commit ebf71ad494
1 changed files with 3 additions and 4 deletions

View File

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