This instance will be upgraded to Heptapod 0.27.1 on 2021-12-08 at 22:00 UTC+1 (a few minutes of down time)

Commit b689e2c0 authored by Douwe Maan's avatar Douwe Maan
Browse files

Fix spec

parent f627c3a1b363
......@@ -198,7 +198,7 @@ def update_forks_visibility_level
if: ->(project) { project.avatar.present? && project.avatar_changed? }
validates :avatar, file_size: { maximum: 200.kilobytes.to_i }
validate :visibility_level_allowed_by_group
validate :visibility_level_allowed_as_fork, on: :update
validate :visibility_level_allowed_as_fork
add_authentication_token_field :runners_token
before_save :ensure_runners_token
......@@ -974,7 +974,12 @@ def open_issues_count
def visibility_level_allowed_as_fork?(level = self.visibility_level)
return true unless forked?
level <= forked_from_project.visibility_level
# self.forked_from_project will be nil before the project is saved, so
# we need to go through the relation
original_project = forked_project_link.forked_from_project
return true unless original_project
level <= original_project.visibility_level
end
def visibility_level_allowed_by_group?(level = self.visibility_level)
......
......@@ -11,7 +11,7 @@
let(:stranger) { create(:user) }
let!(:group_with_members) do
group = create(:group)
group = create(:group, :private)
group.add_users([reporter.id], GroupMember::REPORTER)
group.add_users([developer.id], GroupMember::DEVELOPER)
group.add_users([master.id], GroupMember::MASTER)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment