fix price history spec
This commit is contained in:
parent
d602b7cd0d
commit
ebf71ad494
1 changed files with 3 additions and 4 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue