Skip to content

Commit

Permalink
On #8: Fixes failing tests on github
Browse files Browse the repository at this point in the history
  • Loading branch information
lentschi committed Apr 28, 2024
1 parent 0773a13 commit ddb77f7
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions spec/models/article_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@
end

it 'keeps the properties of article versions in closed orders' do
original_version_id = article_version.id
original_version = article_version.dup
oa = order.order_articles.first
current_article_version = oa.reload.article_version
original_version_id = current_article_version.id
original_version = current_article_version.dup

new_version = create(:article_version)
new_attributes = new_version.attributes.except('updated_at', 'created_at', 'id', 'article_id')
Expand All @@ -36,11 +38,15 @@

article.update(latest_article_version_attributes: new_attributes.merge(id: article_version.id))

new_version = article.latest_article_version
version_in_order = oa.reload.article_version

expect(original_version_id).not_to eq new_version.id
expect(original_version_id).to eq version_in_order.id
new_attributes.each do |key, value|
expect(article.latest_article_version[key]).to eq value
expect(order.order_articles.first.article_version[key]).to eq original_version[key]
expect(new_version[key]).to eq value
expect(version_in_order[key]).to eq(original_version[key])
end
expect(original_version_id).not_to eq article.latest_article_version.id
end
end

Expand Down

0 comments on commit ddb77f7

Please sign in to comment.