Self-hosted project management for devs and their clients: tickets, time tracking, docs and meetings, with an AI assistant that cites its sources. AGPL-3.0.
Ruby agplai-assistantdockerdsgvogdprhotwireissue-trackerjira-alternativeknowledge-basellmmcp-servermeeting-notesopen-sourceproject-managementredmine-alternativeruby-on-railsself-hostedticketingtime-tracking
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe ChatStylePreferencePolicy, :ci_guard do
subject(:policy) { described_class.new(user, :chat_style_preference) }
describe '#update?' do
context 'with a logged-in user' do
let(:user) { create(:user) }
# Kills a `def update? = false` mutation; the real cross-user guard is the
# controller's current_user scoping (covered in the request spec).
it { expect(policy.update?).to be(true) }
end
context 'without a user' do
let(:user) { nil }
# ApplicationPolicy#initialize refuses a nil user outright.
it 'cannot even be constructed' do
expect { described_class.new(nil, :chat_style_preference) }.to raise_error(Pundit::NotAuthorizedError)
end
end
end
end