From 73c99b98e81b18de1cac28839efe6f6c04fba2cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Luka=C5=A1=C3=ADk?= Date: Tue, 13 Dec 2016 22:12:37 +0100 Subject: [PATCH] Specs: should charge after the given time passed --- spec/models/chargeback_container_image_spec.rb | 4 ++-- spec/models/chargeback_container_project_spec.rb | 4 ++-- spec/models/chargeback_vm_spec.rb | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/spec/models/chargeback_container_image_spec.rb b/spec/models/chargeback_container_image_spec.rb index 64b0d87ed66..5a5f7e83a26 100644 --- a/spec/models/chargeback_container_image_spec.rb +++ b/spec/models/chargeback_container_image_spec.rb @@ -1,9 +1,9 @@ describe ChargebackContainerImage do - let(:base_options) { {:interval_size => 1, :end_interval_offset => 0, :ext_options => {:tz => 'UTC'} } } + let(:base_options) { {:interval_size => 2, :end_interval_offset => 0, :ext_options => {:tz => 'UTC'} } } let(:hourly_rate) { 0.01 } let(:starting_date) { Time.parse('2012-09-01 23:59:59Z').utc } let(:ts) { starting_date.in_time_zone(Metric::Helper.get_time_zone(options[:ext_options])) } - let(:report_run_time) { starting_date } + let(:report_run_time) { month_end } let(:month_beginning) { ts.beginning_of_month.utc } let(:month_end) { ts.end_of_month.utc } let(:hours_in_month) { Time.days_in_month(month_beginning.month, month_beginning.year) * 24 } diff --git a/spec/models/chargeback_container_project_spec.rb b/spec/models/chargeback_container_project_spec.rb index d7db45876db..67923ba3364 100644 --- a/spec/models/chargeback_container_project_spec.rb +++ b/spec/models/chargeback_container_project_spec.rb @@ -1,11 +1,11 @@ describe ChargebackContainerProject do include Spec::Support::ChargebackHelper - let(:base_options) { {:interval_size => 1, :end_interval_offset => 0, :ext_options => {:tz => 'UTC'} } } + let(:base_options) { {:interval_size => 2, :end_interval_offset => 0, :ext_options => {:tz => 'UTC'} } } let(:hourly_rate) { 0.01 } let(:starting_date) { Time.parse('2012-09-01 23:59:59Z').utc } let(:ts) { starting_date.in_time_zone(Metric::Helper.get_time_zone(options[:ext_options])) } - let(:report_run_time) { starting_date } + let(:report_run_time) { month_end } let(:month_beginning) { ts.beginning_of_month.utc } let(:month_end) { ts.end_of_month.utc } let(:hours_in_month) { Time.days_in_month(month_beginning.month, month_beginning.year) * 24 } diff --git a/spec/models/chargeback_vm_spec.rb b/spec/models/chargeback_vm_spec.rb index 42e039c9e2d..0b9ee88586b 100644 --- a/spec/models/chargeback_vm_spec.rb +++ b/spec/models/chargeback_vm_spec.rb @@ -3,7 +3,7 @@ let(:admin) { FactoryGirl.create(:user_admin) } let(:base_options) do - {:interval_size => 1, + {:interval_size => 2, :end_interval_offset => 0, :tag => '/managed/environment/prod', :ext_options => {:tz => 'UTC'}, @@ -15,8 +15,8 @@ let(:memory_available) { 1000.0 } let(:vm_allocated_disk_storage) { 4.0 } let(:starting_date) { Time.parse('2012-09-01 23:59:59Z').utc } - let(:ts) { starting_date.in_time_zone(Metric::Helper.get_time_zone(options[:ext_options])) } - let(:report_run_time) { starting_date } + let(:ts) { starting_date.in_time_zone(Metric::Helper.get_time_zone(base_options[:ext_options])) } + let(:report_run_time) { month_end } let(:month_beginning) { ts.beginning_of_month.utc } let(:month_end) { ts.end_of_month.utc } let(:hours_in_month) { Time.days_in_month(month_beginning.month, month_beginning.year) * 24 }