Skip to content

Commit

Permalink
Merge pull request #20078 from lpichler/add_col_format_with_defaults_…
Browse files Browse the repository at this point in the history
…specs

Specs for MiqReport#col_format_with_defaults

(cherry picked from commit e712553)
  • Loading branch information
gtanzillo authored and simaishi committed Apr 23, 2020
1 parent 27245f7 commit 9c954d9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/models/miq_report_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1238,6 +1238,17 @@ def user_super_admin?
expect(row[label_report_column]).to eq(label_value)
end
end

context "more columns with default formatters" do
let(:report_columns) { %w[start_date display_range vm_name cpu_used_cost fixed_compute_1_rate memory_used_metric cpu_used_metric] }
let(:expected_formatters) { [:datetime, nil, nil, :currency_precision_2, nil, :megabytes_human_precision_2, :mhz_precision_2] }
let(:report) { FactoryBot.create(:miq_report, :db => "ChargebackVm", :cols => report_columns, :col_order => report_columns) }

it "calculates default formatters" do
expect(report.col_format_with_defaults).to eq(expected_formatters)
expect(report.col_formats).to be_nil
end
end
end

describe "_async_generate_table" do
Expand Down

0 comments on commit 9c954d9

Please sign in to comment.