From 78e6392f60e210be900b0c24350a97a5a06bc500 Mon Sep 17 00:00:00 2001 From: Sylvain Date: Wed, 11 Sep 2019 14:29:35 +0200 Subject: [PATCH] do not display invoice update logs in test mode + updated reservations fixtures w/o stp_invoice_id column + helper script to run tests --- app/models/invoice.rb | 1 + app/models/invoice_item.rb | 1 + scripts/run-tests.sh | 6 ++++++ test/fixtures/reservations.yml | 2 -- 4 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 scripts/run-tests.sh diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 40507974a..bc161ba9f 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -313,6 +313,7 @@ class Invoice < ActiveRecord::Base end def log_changes + return if Rails.env.test? return unless changed? puts "WARNING: Invoice update triggered [ id: #{id}, reference: #{reference} ]" diff --git a/app/models/invoice_item.rb b/app/models/invoice_item.rb index 54e6511a2..724b7271f 100644 --- a/app/models/invoice_item.rb +++ b/app/models/invoice_item.rb @@ -35,6 +35,7 @@ class InvoiceItem < ActiveRecord::Base end def log_changes + return if Rails.env.test? return unless changed? puts "WARNING: InvoiceItem update triggered [ id: #{id}, invoice reference: #{invoice.reference} ]" diff --git a/scripts/run-tests.sh b/scripts/run-tests.sh new file mode 100644 index 000000000..70c1b69f5 --- /dev/null +++ b/scripts/run-tests.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +RAILS_ENV=test rake db:drop +RAILS_ENV=test rake db:create +RAILS_ENV=test rake db:migrate +rake test diff --git a/test/fixtures/reservations.yml b/test/fixtures/reservations.yml index 7d456a425..bf7800cee 100644 --- a/test/fixtures/reservations.yml +++ b/test/fixtures/reservations.yml @@ -7,7 +7,6 @@ reservation_1: updated_at: 2012-03-12 11:03:31.651441000 Z reservable_id: 2 reservable_type: Training - stp_invoice_id: nb_reserve_places: reservation_2: @@ -18,5 +17,4 @@ reservation_2: updated_at: 2015-06-10 11:20:01.341130000 Z reservable_id: 4 reservable_type: Machine - stp_invoice_id: nb_reserve_places: