Commit 40c0a390 authored by Małgorzata Ksionek's avatar Małgorzata Ksionek

Fix specs and rubocop failures

parent c99e761e
......@@ -107,10 +107,7 @@ class Projects::ForksController < Projects::ApplicationController
end
def memberships_hash
current_user.members.inject({}) do |memberships, member|
memberships[member.source_id] = member
memberships
end
current_user.members.index_by(&:source_id)
end
end
......
......@@ -8,11 +8,9 @@ RSpec.describe ForkNamespaceEntity do
let(:namespace) { create(:group_with_deletion_schedule, :with_avatar, description: 'test', marked_for_deletion_on: 1.day.ago) }
let(:memberships) do
user.members.inject({}) do |memberships, member|
memberships[member.source_id] = member
memberships
end
user.members.index_by(&:source_id)
end
let(:entity) { described_class.new(namespace, current_user: user, project: project, memberships: memberships) }
subject(:json) { entity.as_json }
......
......@@ -8,21 +8,18 @@ RSpec.describe ForkNamespaceEntity do
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project) }
let(:namespace) { create(:group, :with_avatar, description: 'test') }
let_it_be(:namespace) { create(:group, :with_avatar, description: 'test') }
let(:memberships) do
user.members.inject({}) do |memberships, member|
memberships[member.source_id] = member
memberships
end
user.members.index_by(&:source_id)
end
let(:entity) { described_class.new(namespace, current_user: user, project: project, memberships: memberships) }
subject(:json) { entity.as_json }
before do
project.add_maintainer(user)
namespace.add_developer(user)
project.add_maintainer(user)
end
it 'renders json' do
......
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