spec: fix

some times comes integer sometime comes float string
main
Washington Botelho 2019-10-03 20:25:23 -03:00
parent dc110bd38c
commit 69003bd30c
No known key found for this signature in database
GPG Key ID: 5DE4F42A8F073617
2 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ RSpec.describe Rating::Rating, ':averager_data' do
subject(:result) { described_class.averager_data article_1, nil }
it 'returns the values average of given resource type' do
expect(result.as_json['rating_avg']).to eq 30.5
expect(result.as_json['rating_avg'].to_f.to_s).to eq '30.5'
end
it 'returns the average of number of records for the given resource type' do
@ -22,11 +22,11 @@ RSpec.describe Rating::Rating, ':averager_data' do
subject(:result) { described_class.averager_data article_1, category }
it 'returns the values average of given resource type' do
expect(result.as_json['rating_avg']).to eq 1.5
expect(result.as_json['rating_avg'].to_f.to_s).to eq '1.5'
end
it 'returns the average of number of records for the given resource type' do
expect(result.as_json['count_avg']).to eq 2
expect(result.as_json['count_avg'].to_f.to_s).to eq '2.0'
end
end
end

View File

@ -10,15 +10,15 @@ RSpec.describe Rating::Rating, ':values_data' do
subject(:result) { described_class.values_data article_1, nil }
it 'returns the average of value for a resource' do
expect(result.as_json['rating_avg']).to eq 50.5
expect(result.as_json['rating_avg'].to_f.to_s).to eq '50.5'
end
it 'returns the sum of values for a resource' do
expect(result.as_json['rating_sum']).to eq 101
expect(result.as_json['rating_sum'].to_f.to_s).to eq '101.0'
end
it 'returns the count of votes for a resource' do
expect(result.as_json['rating_count']).to eq 2
expect(result.as_json['rating_count'].to_f.to_s).to eq '2.0'
end
end
@ -26,15 +26,15 @@ RSpec.describe Rating::Rating, ':values_data' do
subject(:result) { described_class.values_data article_1, category }
it 'returns the average of value for a resource' do
expect(result.as_json['rating_avg']).to eq 1.5
expect(result.as_json['rating_avg'].to_f.to_s).to eq '1.5'
end
it 'returns the sum of values for a resource' do
expect(result.as_json['rating_sum']).to eq 3
expect(result.as_json['rating_sum'].to_f.to_s).to eq '3.0'
end
it 'returns the count of votes for a resource' do
expect(result.as_json['rating_count']).to eq 2
expect(result.as_json['rating_count'].to_f.to_s).to eq '2.0'
end
end
end