Commit 67b49089 authored by Tan Le's avatar Tan Le

Remove redundant method delegation on group model

This change also cleans up some code styles on related specs according
to Rubocop todos.
parent 505e29d3
...@@ -118,8 +118,6 @@ class Group < Namespace ...@@ -118,8 +118,6 @@ class Group < Namespace
.where("project_authorizations.user_id IN (?)", user_ids) .where("project_authorizations.user_id IN (?)", user_ids)
end end
delegate :default_branch_name, to: :namespace_settings
class << self class << self
def sort_by_attribute(method) def sort_by_attribute(method)
if method == 'storage_size_desc' if method == 'storage_size_desc'
......
...@@ -2214,17 +2214,17 @@ RSpec.describe Group do ...@@ -2214,17 +2214,17 @@ RSpec.describe Group do
end end
describe "#default_branch_name" do describe "#default_branch_name" do
context "group.namespace_settings does not have a default branch name" do context "when group.namespace_settings does not have a default branch name" do
it "returns nil" do it "returns nil" do
expect(group.default_branch_name).to be_nil expect(group.default_branch_name).to be_nil
end end
end end
context "group.namespace_settings has a default branch name" do context "when group.namespace_settings has a default branch name" do
let(:example_branch_name) { "example_branch_name" } let(:example_branch_name) { "example_branch_name" }
before do before do
expect(group.namespace_settings) allow(group.namespace_settings)
.to receive(:default_branch_name) .to receive(:default_branch_name)
.and_return(example_branch_name) .and_return(example_branch_name)
end end
......
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