From f1d3a92bd64e9a503335d089057cca559a74b5ef Mon Sep 17 00:00:00 2001 From: "http://jneen.net/" Date: Thu, 2 Mar 2017 17:43:05 -0800 Subject: [PATCH] spec the behavior of nil subjects --- spec/models/ability_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index 30f8fdf91b2..92d70cfc64c 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -1,6 +1,12 @@ require 'spec_helper' describe Ability, lib: true do + context 'using a nil subject' do + it 'is always empty' do + expect(Ability.allowed(nil, nil).to_set).to be_empty + end + end + describe '.can_edit_note?' do let(:project) { create(:empty_project) } let(:note) { create(:note_on_issue, project: project) }