parent
dc110bd38c
commit
69003bd30c
|
@ -10,7 +10,7 @@ RSpec.describe Rating::Rating, ':averager_data' do
|
||||||
subject(:result) { described_class.averager_data article_1, nil }
|
subject(:result) { described_class.averager_data article_1, nil }
|
||||||
|
|
||||||
it 'returns the values average of given resource type' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the average of number of records for the given resource type' do
|
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 }
|
subject(:result) { described_class.averager_data article_1, category }
|
||||||
|
|
||||||
it 'returns the values average of given resource type' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the average of number of records for the given resource type' do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,15 +10,15 @@ RSpec.describe Rating::Rating, ':values_data' do
|
||||||
subject(:result) { described_class.values_data article_1, nil }
|
subject(:result) { described_class.values_data article_1, nil }
|
||||||
|
|
||||||
it 'returns the average of value for a resource' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the sum of values for a resource' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the count of votes for a resource' do
|
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
|
end
|
||||||
|
|
||||||
|
@ -26,15 +26,15 @@ RSpec.describe Rating::Rating, ':values_data' do
|
||||||
subject(:result) { described_class.values_data article_1, category }
|
subject(:result) { described_class.values_data article_1, category }
|
||||||
|
|
||||||
it 'returns the average of value for a resource' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the sum of values for a resource' do
|
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
|
end
|
||||||
|
|
||||||
it 'returns the count of votes for a resource' do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue