Skip to content

Instantly share code, notes, and snippets.

@dreamr
Created March 1, 2013 03:40
Show Gist options
  • Save dreamr/5062306 to your computer and use it in GitHub Desktop.
Save dreamr/5062306 to your computer and use it in GitHub Desktop.
describe "unpublished reviews are fucking up listing scores" do
let(:reviewable) { create(:dispensary) }
let(:user) { create :user }
before do
25.times do
review = Review.create! user: user, reviewable: reviewable,
title: "title", body: "body"
review.create_rates atmosphere: 5, bud_quality: 5, accessibility: 5,
staff: 5, price: 5
end
end
it "unpublished reviews will not affect ratingsof a dispensary" do
old_average = subject.rating_average
5.times do
review = Review.create! user: user, reviewable: reviewable,
title: "title", body: "body", deleted_at: 1.day.ago
review.create_rates atmosphere: 1, bud_quality: 1, accessibility: 1,
staff: 1, price: 1
end
old_average.must_equal subject.rating_average
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment