docbrown/spec/models/feed_event_spec.rb
PJ 3f7d1fbc1a
Create feed impression and click events (#20043)
* getting started: model setup

* basic controller action & spec

* somewhat working click events

* pick up on impressions

* there was an attempt at batching without duplicates

* (better) bulk upsert service

* fix specs?

* touch up feed events JS

* end-to-end specs??

* workers wip

* fix failing user delete spec
2023-09-11 13:32:36 +01:00

14 lines
658 B
Ruby

require "rails_helper"
RSpec.describe FeedEvent do
describe "validations" do
it { is_expected.to belong_to(:article).optional }
it { is_expected.to validate_numericality_of(:article_id).only_integer }
it { is_expected.to belong_to(:user).optional }
it { is_expected.to validate_numericality_of(:user_id).only_integer.allow_nil }
it { is_expected.to define_enum_for(:category).with_values(%i[impression click reaction comment]) }
it { is_expected.to validate_numericality_of(:article_position).is_greater_than(0).only_integer }
it { is_expected.to validate_inclusion_of(:context_type).in_array(%w[home search tag]) }
end
end