diff --git a/spec/models/chargeback_container_project_spec.rb b/spec/models/chargeback_container_project_spec.rb index 67923ba3364..e6f189588ba 100644 --- a/spec/models/chargeback_container_project_spec.rb +++ b/spec/models/chargeback_container_project_spec.rb @@ -4,7 +4,7 @@ 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(: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 } @@ -32,7 +32,8 @@ ChargebackRate.seed EvmSpecHelper.create_guid_miq_server_zone - @project = FactoryGirl.create(:container_project, :name => "my project", :ext_management_system => ems) + @project = FactoryGirl.create(:container_project, :name => "my project", :ext_management_system => ems, + :created_on => month_beginning) temp = {:cb_rate => chargeback_rate, :object => ems} ChargebackRate.set_assignments(:compute, [temp]) diff --git a/spec/models/chargeback_vm/ongoing_time_period_spec.rb b/spec/models/chargeback_vm/ongoing_time_period_spec.rb index ed063e31d30..158c40bc78b 100644 --- a/spec/models/chargeback_vm/ongoing_time_period_spec.rb +++ b/spec/models/chargeback_vm/ongoing_time_period_spec.rb @@ -16,7 +16,8 @@ let(:tag) { Tag.find_by_name('/managed/environment/prod') } let(:vm) do ems = FactoryGirl.create(:ems_vmware) - vm = FactoryGirl.create(:vm_vmware, :name => 'test_vm', :evm_owner => admin, :ems_ref => 'ems_ref') + vm = FactoryGirl.create(:vm_vmware, :name => 'test_vm', :evm_owner => admin, :ems_ref => 'ems_ref', + :created_on => start_of_all_intervals) vm.tag_with(tag.name, :ns => '*') host = FactoryGirl.create(:host, :hardware => FactoryGirl.create(:hardware, :memory_mb => 8124, :cpu_total_cores => 1, diff --git a/spec/models/chargeback_vm_spec.rb b/spec/models/chargeback_vm_spec.rb index e1cb32abbf6..82a94679cbd 100644 --- a/spec/models/chargeback_vm_spec.rb +++ b/spec/models/chargeback_vm_spec.rb @@ -53,7 +53,8 @@ c = FactoryGirl.create(:classification, :name => "prod", :description => "Production", :parent_id => cat.id) @tag = Tag.find_by_name("/managed/environment/prod") - @vm1 = FactoryGirl.create(:vm_vmware, :name => "test_vm", :evm_owner => admin, :ems_ref => "ems_ref") + @vm1 = FactoryGirl.create(:vm_vmware, :name => "test_vm", :evm_owner => admin, :ems_ref => "ems_ref", + :created_on => month_beginning) @vm1.tag_with(@tag.name, :ns => '*') @host1 = FactoryGirl.create(:host, :hardware => FactoryGirl.create(:hardware, :memory_mb => 8124, :cpu_total_cores => 1, :cpu_speed => 9576), :vms => [@vm1]) @@ -527,7 +528,7 @@ context 'for SCVMM (hyper-v)' do let!(:vm1) do - vm = FactoryGirl.create(:vm_microsoft) + vm = FactoryGirl.create(:vm_microsoft, :created_on => report_run_time - 1.day) vm.tag_with(@tag.name, :ns => '*') vm end