* Prevent need for eager loading
* Add initial implementation of user block
* Remove debugger oops
* Add index and foreign keys for user_block table
* Use private method instead of exists
* Move channel handling logic to service object
* Update styling a bit
* Use profileDropdown file for future proofing
* Remove commented out code
* Render json: { result } for all endpoints
* Add statuses for sad paths
* Add better sad path handling in the JS
* Remove accidentally committed spec file
* Don't wait for DOM to load block button
* Use equality for accuracy in slug query
* Add status code for unauthorized requests
* Add missing comma sigh
16 lines
544 B
Ruby
16 lines
544 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe UserBlock, type: :model do
|
|
let(:blocker) { create(:user) }
|
|
let(:blocked) { create(:user) }
|
|
|
|
describe "validations" do
|
|
it { is_expected.to validate_inclusion_of(:config).in_array(%w[default]) }
|
|
|
|
it "prevents the blocker from blocking itself" do
|
|
user_block = UserBlock.new(blocker_id: 1, blocked_id: 1, config: "default")
|
|
expect(user_block.valid?).to eq false
|
|
expect(user_block.errors.full_messages).to include "Blocker can't be the same as the blocked_id"
|
|
end
|
|
end
|
|
end
|