* Rename positive_reactions_count to public_reactions_count * Add positive reactions count back in so we can remove it * Use public_category method for reactions * Add positive_reactions_count in case any old caches rely on it * Add positive_rxn_count to account for API endpoints * Remove unused method * One more spot... * Add method back in because of caches * Update specs to match new functionality * Fix typo * Remove unused methods
18 lines
597 B
Ruby
18 lines
597 B
Ruby
RSpec.shared_examples "#sync_reactions_count" do |reactable_type|
|
|
context "with syncable reactions count" do
|
|
let(:reactable) { create(reactable_type) }
|
|
|
|
before do
|
|
create(:reaction, points: 1, reactable: reactable)
|
|
create(:reaction, points: 0, reactable: reactable)
|
|
end
|
|
|
|
it "syncs reactions count" do
|
|
expect(reactable.public_reactions_count).to eq(0)
|
|
reactable.sync_reactions_count
|
|
reactable.reload
|
|
expected_count = reactable.reactions.public_category.size
|
|
expect(reactable.public_reactions_count).to eq(expected_count)
|
|
end
|
|
end
|
|
end
|