diff --git a/app/models/ability.rb b/app/models/ability.rb index 27cd52f59..cd10e3cac 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -4,7 +4,7 @@ class Ability include CanCan::Ability def initialize(user) - define_common_non_student_abilities(user) + define_common_abilities return unless user @@ -22,9 +22,7 @@ def initialize(user) private - def define_common_non_student_abilities(user) - return if user&.student? - + def define_common_abilities # Anyone can view projects not owned by a user or a school. can :show, Project, user_id: nil, school_id: nil can :show, Component, project: { user_id: nil, school_id: nil } diff --git a/spec/models/ability_spec.rb b/spec/models/ability_spec.rb index c648e19aa..5f34facff 100644 --- a/spec/models/ability_spec.rb +++ b/spec/models/ability_spec.rb @@ -544,7 +544,7 @@ context 'with a starter project' do it { is_expected.not_to be_able_to(:index, starter_project) } - it { is_expected.not_to be_able_to(:show, starter_project) } + it { is_expected.to be_able_to(:show, starter_project) } it { is_expected.not_to be_able_to(:create, starter_project) } it { is_expected.not_to be_able_to(:update, starter_project) } it { is_expected.not_to be_able_to(:destroy, starter_project) }