replace deprecated update_attributes with update

This commit is contained in:
viehlieb 2022-10-13 18:25:52 +02:00 committed by Patrick Gansterer
parent eb45a2bf21
commit 3ffdb424d5
28 changed files with 52 additions and 53 deletions

View file

@ -14,10 +14,10 @@ describe Api::V1::OrderArticlesController, type: :controller do
let(:order_articles) { order.order_articles }
before do
order_articles[0].update_attributes! quantity: 0, tolerance: 0, units_to_order: 0
order_articles[1].update_attributes! quantity: 1, tolerance: 0, units_to_order: 0
order_articles[2].update_attributes! quantity: 0, tolerance: 1, units_to_order: 0
order_articles[3].update_attributes! quantity: 0, tolerance: 0, units_to_order: 1
order_articles[0].update!(quantity: 0, tolerance: 0, units_to_order: 0)
order_articles[1].update!(quantity: 1, tolerance: 0, units_to_order: 0)
order_articles[2].update!(quantity: 0, tolerance: 1, units_to_order: 0)
order_articles[3].update!(quantity: 0, tolerance: 0, units_to_order: 1)
end
it "(unset)" do

View file

@ -97,7 +97,7 @@ feature 'settling an order', js: true do
end
it 'deletes a GroupOrderArticle with no ordered amounts' do
goa1.update_attributes({ :quantity => 0, :tolerance => 0 })
goa1.update(quantity: 0, tolerance: 0)
click_link article.name
expect(page).to have_selector("#group_order_article_#{goa1.id}")
within("#group_order_article_#{goa1.id}") do

View file

@ -78,7 +78,7 @@ describe Article do
# TODO move article sync from supplier to article
article # need to reference for it to exist when syncing
updated_article = supplier.sync_all[0].select { |s| s[0].id == article.id }.first[0]
article.update_attributes updated_article.attributes.reject { |k, v| k == 'id' or k == 'type' }
article.update(updated_article.attributes.reject { |k, v| k == 'id' or k == 'type' })
expect(article.name).to eq(shared_article.name)
# now synchronising shouldn't change anything anymore
expect(article.shared_article_changed?).to be_falsey
@ -101,14 +101,14 @@ describe Article do
article.save!
# TODO get sync functionality in article
updated_article = supplier.sync_all[0].select { |s| s[0].id == article.id }.first[0]
article.update_attributes! updated_article.attributes.reject { |k, v| k == 'id' or k == 'type' }
article.update!(updated_article.attributes.reject { |k, v| k == 'id' or k == 'type' })
expect(article.unit).to eq '200g'
expect(article.unit_quantity).to eq 5
expect(article.price).to be_within(0.005).of(shared_article.price / 5)
end
it 'does not synchronise when it has no order number' do
article.update_attributes :order_number => nil
article.update(order_number: nil)
expect(supplier.sync_all).to eq [[], [], []]
end
end

View file

@ -151,7 +151,7 @@ describe OrderArticle do
# actual test
it(success ? 'succeeds' : 'fails') do
order.update_attributes(boxfill: boxfill_from)
order.update(boxfill: boxfill_from)
r = proc {
goa.update_quantities(*q.values[0])

View file

@ -127,13 +127,13 @@ describe Ordergroup do
expect(og.account_balance).to eq 444
ftc1.reload
ftc1.update_attributes!(ignore_for_account_balance: true)
ftc1.update!(ignore_for_account_balance: true)
og.reload
expect(og.account_balance).to eq 440
ftt2.reload
ftt2.update_attributes!(financial_transaction_class: ftc1)
ftt2.update!(financial_transaction_class: ftc1)
og.reload
expect(og.account_balance).to eq 400
@ -146,7 +146,7 @@ describe Ordergroup do
expect(result["sum_of_class_#{ftc2.id}"]).to eq 440
ftt2.reload
ftt2.update_attributes!(financial_transaction_class: ftc1)
ftt2.update!(financial_transaction_class: ftc1)
result = Ordergroup.include_transaction_class_sum.where(id: og).first
expect(result["sum_of_class_#{ftc1.id}"]).to eq 44