replace deprecated update_attributes with update
This commit is contained in:
parent
eb45a2bf21
commit
3ffdb424d5
28 changed files with 52 additions and 53 deletions
|
@ -23,7 +23,7 @@ class Admin::BankAccountsController < Admin::BaseController
|
||||||
def update
|
def update
|
||||||
@bank_account = BankAccount.find(params[:id])
|
@bank_account = BankAccount.find(params[:id])
|
||||||
|
|
||||||
if @bank_account.update_attributes(params[:bank_account])
|
if @bank_account.update(params[:bank_account])
|
||||||
redirect_to update_bank_accounts_admin_finances_url, :status => 303
|
redirect_to update_bank_accounts_admin_finances_url, :status => 303
|
||||||
else
|
else
|
||||||
render :action => 'new', :layout => false
|
render :action => 'new', :layout => false
|
||||||
|
|
|
@ -23,7 +23,7 @@ class Admin::FinancialTransactionClassesController < Admin::BaseController
|
||||||
def update
|
def update
|
||||||
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
@financial_transaction_class = FinancialTransactionClass.find(params[:id])
|
||||||
|
|
||||||
if @financial_transaction_class.update_attributes(params[:financial_transaction_class])
|
if @financial_transaction_class.update(params[:financial_transaction_class])
|
||||||
redirect_to update_transaction_types_admin_finances_url, status: 303
|
redirect_to update_transaction_types_admin_finances_url, status: 303
|
||||||
else
|
else
|
||||||
render action: 'new', layout: false
|
render action: 'new', layout: false
|
||||||
|
|
|
@ -24,7 +24,7 @@ class Admin::FinancialTransactionTypesController < Admin::BaseController
|
||||||
def update
|
def update
|
||||||
@financial_transaction_type = FinancialTransactionType.find(params[:id])
|
@financial_transaction_type = FinancialTransactionType.find(params[:id])
|
||||||
|
|
||||||
if @financial_transaction_type.update_attributes(params[:financial_transaction_type])
|
if @financial_transaction_type.update(params[:financial_transaction_type])
|
||||||
redirect_to update_transaction_types_admin_finances_url, status: 303
|
redirect_to update_transaction_types_admin_finances_url, status: 303
|
||||||
else
|
else
|
||||||
render action: 'new', layout: false
|
render action: 'new', layout: false
|
||||||
|
|
|
@ -26,7 +26,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
||||||
goa.update_quantities((create_params[:quantity] || 0).to_i, (create_params[:tolerance] || 0).to_i)
|
goa.update_quantities((create_params[:quantity] || 0).to_i, (create_params[:tolerance] || 0).to_i)
|
||||||
oa.update_results!
|
oa.update_results!
|
||||||
go.update_price!
|
go.update_price!
|
||||||
go.update_attributes! updated_by: current_user
|
go.update!(updated_by: current_user)
|
||||||
end
|
end
|
||||||
render_goa_with_oa(goa)
|
render_goa_with_oa(goa)
|
||||||
end
|
end
|
||||||
|
@ -38,7 +38,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
||||||
goa.update_quantities((update_params[:quantity] || goa.quantity).to_i, (update_params[:tolerance] || goa.tolerance).to_i)
|
goa.update_quantities((update_params[:quantity] || goa.quantity).to_i, (update_params[:tolerance] || goa.tolerance).to_i)
|
||||||
goa.order_article.update_results!
|
goa.order_article.update_results!
|
||||||
goa.group_order.update_price!
|
goa.group_order.update_price!
|
||||||
goa.group_order.update_attributes! updated_by: current_user
|
goa.group_order.update!(updated_by: current_user)
|
||||||
end
|
end
|
||||||
render_goa_with_oa(goa)
|
render_goa_with_oa(goa)
|
||||||
end
|
end
|
||||||
|
@ -50,7 +50,7 @@ class Api::V1::User::GroupOrderArticlesController < Api::V1::BaseController
|
||||||
goa.destroy!
|
goa.destroy!
|
||||||
goa.order_article.update_results!
|
goa.order_article.update_results!
|
||||||
goa.group_order.update_price!
|
goa.group_order.update_price!
|
||||||
goa.group_order.update_attributes! updated_by: current_user
|
goa.group_order.update!(updated_by: current_user)
|
||||||
end
|
end
|
||||||
render_goa_with_oa(nil, goa.order_article)
|
render_goa_with_oa(nil, goa.order_article)
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,7 +64,7 @@ class ArticlesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@article = Article.find(params[:id])
|
@article = Article.find(params[:id])
|
||||||
|
|
||||||
if @article.update_attributes(params[:article])
|
if @article.update(params[:article])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
else
|
else
|
||||||
render :action => 'new', :layout => false
|
render :action => 'new', :layout => false
|
||||||
|
@ -93,7 +93,7 @@ class ArticlesController < ApplicationController
|
||||||
# Update other article attributes...
|
# Update other article attributes...
|
||||||
@articles = Article.find(params[:articles].keys)
|
@articles = Article.find(params[:articles].keys)
|
||||||
@articles.each do |article|
|
@articles.each do |article|
|
||||||
unless article.update_attributes(params[:articles][article.id.to_s])
|
unless article.update(params[:articles][article.id.to_s])
|
||||||
invalid_articles = true unless invalid_articles # Remember that there are validation errors
|
invalid_articles = true unless invalid_articles # Remember that there are validation errors
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,7 @@ class DeliveriesController < ApplicationController
|
||||||
def update
|
def update
|
||||||
@delivery = Delivery.find(params[:id])
|
@delivery = Delivery.find(params[:id])
|
||||||
|
|
||||||
if @delivery.update_attributes(params[:delivery])
|
if @delivery.update(params[:delivery])
|
||||||
flash[:notice] = I18n.t('deliveries.update.notice')
|
flash[:notice] = I18n.t('deliveries.update.notice')
|
||||||
redirect_to [@supplier, @delivery]
|
redirect_to [@supplier, @delivery]
|
||||||
else
|
else
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
|
|
||||||
def update_note
|
def update_note
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
if @order.update_attributes(params[:order])
|
if @order.update(params[:order])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
else
|
else
|
||||||
render :action => :edit_note, :layout => false
|
render :action => :edit_note, :layout => false
|
||||||
|
@ -65,7 +65,7 @@ class Finance::BalancingController < Finance::BaseController
|
||||||
|
|
||||||
def update_transport
|
def update_transport
|
||||||
@order = Order.find(params[:id])
|
@order = Order.find(params[:id])
|
||||||
@order.update_attributes! params[:order]
|
@order.update!(params[:order])
|
||||||
redirect_to new_finance_order_path(order_id: @order.id)
|
redirect_to new_finance_order_path(order_id: @order.id)
|
||||||
rescue => error
|
rescue => error
|
||||||
redirect_to new_finance_order_path(order_id: @order.id), alert: t('errors.general_msg', msg: error.message)
|
redirect_to new_finance_order_path(order_id: @order.id), alert: t('errors.general_msg', msg: error.message)
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Finance::InvoicesController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
if @invoice.update_attributes(params[:invoice])
|
if @invoice.update(params[:invoice])
|
||||||
redirect_to [:finance, @invoice], notice: I18n.t('finance.update.notice')
|
redirect_to [:finance, @invoice], notice: I18n.t('finance.update.notice')
|
||||||
else
|
else
|
||||||
fill_deliveries_and_orders_collection @invoice.id, @invoice.supplier_id
|
fill_deliveries_and_orders_collection @invoice.id, @invoice.supplier_id
|
||||||
|
|
|
@ -12,7 +12,7 @@ class Foodcoop::WorkgroupsController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@workgroup = Workgroup.find(params[:id])
|
@workgroup = Workgroup.find(params[:id])
|
||||||
if @workgroup.update_attributes(params[:workgroup])
|
if @workgroup.update(params[:workgroup])
|
||||||
redirect_to foodcoop_workgroups_url, :notice => I18n.t('workgroups.update.notice')
|
redirect_to foodcoop_workgroups_url, :notice => I18n.t('workgroups.update.notice')
|
||||||
else
|
else
|
||||||
render :action => 'edit'
|
render :action => 'edit'
|
||||||
|
|
|
@ -19,7 +19,7 @@ class GroupOrderArticlesController < ApplicationController
|
||||||
goa = GroupOrderArticle.where(group_order_id: @group_order_article.group_order_id,
|
goa = GroupOrderArticle.where(group_order_id: @group_order_article.group_order_id,
|
||||||
order_article_id: @order_article.id).first
|
order_article_id: @order_article.id).first
|
||||||
|
|
||||||
if goa && goa.update_attributes(params[:group_order_article])
|
if goa && goa.update(params[:group_order_article])
|
||||||
@group_order_article = goa
|
@group_order_article = goa
|
||||||
|
|
||||||
update_summaries(@group_order_article)
|
update_summaries(@group_order_article)
|
||||||
|
@ -38,7 +38,7 @@ class GroupOrderArticlesController < ApplicationController
|
||||||
if params[:delta]
|
if params[:delta]
|
||||||
@group_order_article.update_attribute :result, [@group_order_article.result + params[:delta].to_f, 0].max
|
@group_order_article.update_attribute :result, [@group_order_article.result + params[:delta].to_f, 0].max
|
||||||
else
|
else
|
||||||
@group_order_article.update_attributes(params[:group_order_article])
|
@group_order_article.update(params[:group_order_article])
|
||||||
end
|
end
|
||||||
|
|
||||||
update_summaries(@group_order_article)
|
update_summaries(@group_order_article)
|
||||||
|
|
|
@ -23,8 +23,8 @@ class HomeController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_profile
|
def update_profile
|
||||||
if @current_user.update_attributes(user_params)
|
if @current_user.update(user_params)
|
||||||
@current_user.ordergroup.update_attributes(ordergroup_params) if ordergroup_params
|
@current_user.ordergroup.update(ordergroup_params) if ordergroup_params
|
||||||
session[:locale] = @current_user.locale
|
session[:locale] = @current_user.locale
|
||||||
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
redirect_to my_profile_url, notice: I18n.t('home.changes_saved')
|
||||||
else
|
else
|
||||||
|
|
|
@ -94,7 +94,7 @@ class OrdersController < ApplicationController
|
||||||
# Update an existing order.
|
# Update an existing order.
|
||||||
def update
|
def update
|
||||||
@order = Order.find params[:id]
|
@order = Order.find params[:id]
|
||||||
if @order.update_attributes params[:order].merge(updated_by: current_user)
|
if @order.update(params[:order].merge(updated_by: current_user))
|
||||||
flash[:notice] = I18n.t('orders.update.notice')
|
flash[:notice] = I18n.t('orders.update.notice')
|
||||||
redirect_to :action => 'show', :id => @order
|
redirect_to :action => 'show', :id => @order
|
||||||
else
|
else
|
||||||
|
|
|
@ -54,7 +54,7 @@ class StockitController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@stock_article = StockArticle.find(params[:id])
|
@stock_article = StockArticle.find(params[:id])
|
||||||
@stock_article.update_attributes!(params[:stock_article])
|
@stock_article.update!(params[:stock_article])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
rescue ActiveRecord::RecordInvalid
|
rescue ActiveRecord::RecordInvalid
|
||||||
render :action => 'edit', :layout => false
|
render :action => 'edit', :layout => false
|
||||||
|
|
|
@ -41,7 +41,7 @@ class SuppliersController < ApplicationController
|
||||||
|
|
||||||
def update
|
def update
|
||||||
@supplier = Supplier.find(params[:id])
|
@supplier = Supplier.find(params[:id])
|
||||||
if @supplier.update_attributes(supplier_params)
|
if @supplier.update(supplier_params)
|
||||||
flash[:notice] = I18n.t('suppliers.update.notice')
|
flash[:notice] = I18n.t('suppliers.update.notice')
|
||||||
redirect_to @supplier
|
redirect_to @supplier
|
||||||
else
|
else
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BankTransaction < ApplicationRecord
|
||||||
|
|
||||||
transaction do
|
transaction do
|
||||||
link = FinancialLink.new
|
link = FinancialLink.new
|
||||||
invoices.each { |i| i.update_attributes! financial_link: link, paid_on: date }
|
invoices.each { |i| i.update!(financial_link: link, paid_on: date) }
|
||||||
update_attribute :financial_link, link
|
update_attribute :financial_link, link
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -235,7 +235,7 @@ class Order < ApplicationRecord
|
||||||
unless finished?
|
unless finished?
|
||||||
Order.transaction do
|
Order.transaction do
|
||||||
# set new order state (needed by notify_order_finished)
|
# set new order state (needed by notify_order_finished)
|
||||||
update_attributes!(:state => 'finished', :ends => Time.now, :updated_by => user)
|
update!(state: 'finished', ends: Time.now, updated_by: user)
|
||||||
|
|
||||||
# Update order_articles. Save the current article_price to keep price consistency
|
# Update order_articles. Save the current article_price to keep price consistency
|
||||||
# Also save results for each group_order_result
|
# Also save results for each group_order_result
|
||||||
|
@ -281,7 +281,7 @@ class Order < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self.update_attributes! :state => 'closed', :updated_by => user, :foodcoop_result => profit
|
self.update!(state: 'closed', updated_by: user, foodcoop_result: profit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ class Order < ApplicationRecord
|
||||||
raise I18n.t('orders.model.error_closed') if closed?
|
raise I18n.t('orders.model.error_closed') if closed?
|
||||||
|
|
||||||
comments.create(user: user, text: I18n.t('orders.model.close_direct_message')) unless FoodsoftConfig[:charge_members_manually]
|
comments.create(user: user, text: I18n.t('orders.model.close_direct_message')) unless FoodsoftConfig[:charge_members_manually]
|
||||||
update_attributes! state: 'closed', updated_by: user
|
update!(state: 'closed', updated_by: user)
|
||||||
end
|
end
|
||||||
|
|
||||||
def send_to_supplier!(user)
|
def send_to_supplier!(user)
|
||||||
|
|
|
@ -159,10 +159,10 @@ class OrderArticle < ApplicationRecord
|
||||||
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
|
def update_article_and_price!(order_article_attributes, article_attributes, price_attributes = nil)
|
||||||
OrderArticle.transaction do
|
OrderArticle.transaction do
|
||||||
# Updates self
|
# Updates self
|
||||||
self.update_attributes!(order_article_attributes)
|
self.update!(order_article_attributes)
|
||||||
|
|
||||||
# Updates article
|
# Updates article
|
||||||
article.update_attributes!(article_attributes)
|
article.update!(article_attributes)
|
||||||
|
|
||||||
# Updates article_price belonging to current order article
|
# Updates article_price belonging to current order article
|
||||||
if price_attributes.present?
|
if price_attributes.present?
|
||||||
|
@ -170,7 +170,7 @@ class OrderArticle < ApplicationRecord
|
||||||
if article_price.changed?
|
if article_price.changed?
|
||||||
# Updates also price attributes of article if update_global_price is selected
|
# Updates also price attributes of article if update_global_price is selected
|
||||||
if update_global_price
|
if update_global_price
|
||||||
article.update_attributes!(price_attributes)
|
article.update!(price_attributes)
|
||||||
self.article_price = article.article_prices.first and save # Assign new created article price to order article
|
self.article_price = article.article_prices.first and save # Assign new created article price to order article
|
||||||
else
|
else
|
||||||
# Creates a new article_price if neccessary
|
# Creates a new article_price if neccessary
|
||||||
|
|
|
@ -16,14 +16,14 @@ class RemoveTableArticlePrices < ActiveRecord::Migration[4.2]
|
||||||
puts "now copy values of article_prices into new articles-columns..."
|
puts "now copy values of article_prices into new articles-columns..."
|
||||||
Article.find(:all).each do |article|
|
Article.find(:all).each do |article|
|
||||||
price = article.current_price
|
price = article.current_price
|
||||||
article.update_attributes!(:clear_price => price.clear_price,
|
article.update!(clear_price: price.clear_price,
|
||||||
:gross_price => price.gross_price,
|
gross_price: price.gross_price,
|
||||||
:tax => price.tax,
|
tax: price.tax,
|
||||||
:refund => price.refund,
|
refund: price.refund,
|
||||||
:unit_quantity => price.unit_quantity,
|
unit_quantity: price.unit_quantity,
|
||||||
:order_number => price.order_number,
|
order_number: price.order_number,
|
||||||
:updated_at => price.updated_on,
|
updated_at: price.updated_on,
|
||||||
:created_at => price.updated_on)
|
created_at: price.updated_on)
|
||||||
end
|
end
|
||||||
|
|
||||||
puts "delete article_prices, current_price attribute"
|
puts "delete article_prices, current_price attribute"
|
||||||
|
|
|
@ -47,8 +47,7 @@ class RoadToVersionThree < ActiveRecord::Migration[4.2]
|
||||||
Ordergroup.all.each do |ordergroup|
|
Ordergroup.all.each do |ordergroup|
|
||||||
contact = ordergroup.users.first
|
contact = ordergroup.users.first
|
||||||
if contact
|
if contact
|
||||||
ordergroup.update_attributes :contact_person => contact.name,
|
ordergroup.update(contact_person: contact.name, contact_phone: contact.phone, contact_address: contact.address)
|
||||||
:contact_phone => contact.phone, :contact_address => contact.address
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
remove_column :users, :address
|
remove_column :users, :address
|
||||||
|
|
|
@ -27,7 +27,7 @@ class MoveWeeklyTasks < ActiveRecord::Migration[4.2]
|
||||||
task_required_users: task.required_users,
|
task_required_users: task.required_users,
|
||||||
task_duration: task.duration
|
task_duration: task.duration
|
||||||
}
|
}
|
||||||
workgroup.update_attributes workgroup_attributes
|
workgroup.update(workgroup_attributes)
|
||||||
task_group.tasks.update_all weekly: true
|
task_group.tasks.update_all weekly: true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Admin::LinksController < Admin::BaseController
|
||||||
def update
|
def update
|
||||||
@link = Link.find(params[:id])
|
@link = Link.find(params[:id])
|
||||||
|
|
||||||
if @link.update_attributes!(link_params)
|
if @link.update!(link_params)
|
||||||
index
|
index
|
||||||
render action: :update_links
|
render action: :update_links
|
||||||
else
|
else
|
||||||
|
|
|
@ -37,7 +37,7 @@ class PollsController < ApplicationController
|
||||||
|
|
||||||
if user_has_no_right
|
if user_has_no_right
|
||||||
redirect_to polls_path, alert: t('.no_right')
|
redirect_to polls_path, alert: t('.no_right')
|
||||||
elsif @poll.update_attributes(poll_params)
|
elsif @poll.update(poll_params)
|
||||||
redirect_to @poll, notice: t('.notice')
|
redirect_to @poll, notice: t('.notice')
|
||||||
else
|
else
|
||||||
render action: 'edit'
|
render action: 'edit'
|
||||||
|
|
|
@ -26,6 +26,6 @@ class PrinterJob < ActiveRecord::Base
|
||||||
def finish!(user = nil)
|
def finish!(user = nil)
|
||||||
return unless finished_at.nil?
|
return unless finished_at.nil?
|
||||||
|
|
||||||
update_attributes finished_at: Time.now, finished_by: user
|
update(finished_at: Time.now, finished_by: user)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -14,10 +14,10 @@ describe Api::V1::OrderArticlesController, type: :controller do
|
||||||
let(:order_articles) { order.order_articles }
|
let(:order_articles) { order.order_articles }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
order_articles[0].update_attributes! quantity: 0, tolerance: 0, units_to_order: 0
|
order_articles[0].update!(quantity: 0, tolerance: 0, units_to_order: 0)
|
||||||
order_articles[1].update_attributes! quantity: 1, tolerance: 0, units_to_order: 0
|
order_articles[1].update!(quantity: 1, tolerance: 0, units_to_order: 0)
|
||||||
order_articles[2].update_attributes! quantity: 0, tolerance: 1, units_to_order: 0
|
order_articles[2].update!(quantity: 0, tolerance: 1, units_to_order: 0)
|
||||||
order_articles[3].update_attributes! quantity: 0, tolerance: 0, units_to_order: 1
|
order_articles[3].update!(quantity: 0, tolerance: 0, units_to_order: 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "(unset)" do
|
it "(unset)" do
|
||||||
|
|
|
@ -97,7 +97,7 @@ feature 'settling an order', js: true do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'deletes a GroupOrderArticle with no ordered amounts' do
|
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
|
click_link article.name
|
||||||
expect(page).to have_selector("#group_order_article_#{goa1.id}")
|
expect(page).to have_selector("#group_order_article_#{goa1.id}")
|
||||||
within("#group_order_article_#{goa1.id}") do
|
within("#group_order_article_#{goa1.id}") do
|
||||||
|
|
|
@ -78,7 +78,7 @@ describe Article do
|
||||||
# TODO move article sync from supplier to article
|
# TODO move article sync from supplier to article
|
||||||
article # need to reference for it to exist when syncing
|
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]
|
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)
|
expect(article.name).to eq(shared_article.name)
|
||||||
# now synchronising shouldn't change anything anymore
|
# now synchronising shouldn't change anything anymore
|
||||||
expect(article.shared_article_changed?).to be_falsey
|
expect(article.shared_article_changed?).to be_falsey
|
||||||
|
@ -101,14 +101,14 @@ describe Article do
|
||||||
article.save!
|
article.save!
|
||||||
# TODO get sync functionality in article
|
# TODO get sync functionality in article
|
||||||
updated_article = supplier.sync_all[0].select { |s| s[0].id == article.id }.first[0]
|
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).to eq '200g'
|
||||||
expect(article.unit_quantity).to eq 5
|
expect(article.unit_quantity).to eq 5
|
||||||
expect(article.price).to be_within(0.005).of(shared_article.price / 5)
|
expect(article.price).to be_within(0.005).of(shared_article.price / 5)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not synchronise when it has no order number' do
|
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 [[], [], []]
|
expect(supplier.sync_all).to eq [[], [], []]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -151,7 +151,7 @@ describe OrderArticle do
|
||||||
|
|
||||||
# actual test
|
# actual test
|
||||||
it(success ? 'succeeds' : 'fails') do
|
it(success ? 'succeeds' : 'fails') do
|
||||||
order.update_attributes(boxfill: boxfill_from)
|
order.update(boxfill: boxfill_from)
|
||||||
|
|
||||||
r = proc {
|
r = proc {
|
||||||
goa.update_quantities(*q.values[0])
|
goa.update_quantities(*q.values[0])
|
||||||
|
|
|
@ -127,13 +127,13 @@ describe Ordergroup do
|
||||||
expect(og.account_balance).to eq 444
|
expect(og.account_balance).to eq 444
|
||||||
|
|
||||||
ftc1.reload
|
ftc1.reload
|
||||||
ftc1.update_attributes!(ignore_for_account_balance: true)
|
ftc1.update!(ignore_for_account_balance: true)
|
||||||
|
|
||||||
og.reload
|
og.reload
|
||||||
expect(og.account_balance).to eq 440
|
expect(og.account_balance).to eq 440
|
||||||
|
|
||||||
ftt2.reload
|
ftt2.reload
|
||||||
ftt2.update_attributes!(financial_transaction_class: ftc1)
|
ftt2.update!(financial_transaction_class: ftc1)
|
||||||
|
|
||||||
og.reload
|
og.reload
|
||||||
expect(og.account_balance).to eq 400
|
expect(og.account_balance).to eq 400
|
||||||
|
@ -146,7 +146,7 @@ describe Ordergroup do
|
||||||
expect(result["sum_of_class_#{ftc2.id}"]).to eq 440
|
expect(result["sum_of_class_#{ftc2.id}"]).to eq 440
|
||||||
|
|
||||||
ftt2.reload
|
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
|
result = Ordergroup.include_transaction_class_sum.where(id: og).first
|
||||||
expect(result["sum_of_class_#{ftc1.id}"]).to eq 44
|
expect(result["sum_of_class_#{ftc1.id}"]).to eq 44
|
||||||
|
|
Loading…
Reference in a new issue