Skip to content

Commit

Permalink
Merge pull request #18669 from Fryguy/move_git_repo_constant
Browse files Browse the repository at this point in the history
Move GIT_REPO_DIRECTORY constant from MiqAeDatastore
  • Loading branch information
mkanoor committed Apr 22, 2019
2 parents 80f2be4 + 5500b52 commit 96b4737
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/models/git_repository.rb
@@ -1,6 +1,8 @@
class GitRepository < ApplicationRecord
include AuthenticationMixin

GIT_REPO_DIRECTORY = Rails.root.join('data/git_repos')

validates :url, :format => URI::regexp(%w(http https)), :allow_nil => false
validate :check_path

Expand Down Expand Up @@ -38,7 +40,7 @@ def tag_info(name)
def directory_name
parsed = URI.parse(url)
raise "Invalid URL missing path" if parsed.path.blank?
File.join(MiqAeDatastore::GIT_REPO_DIRECTORY, parsed.path)
File.join(GIT_REPO_DIRECTORY, parsed.path)
end

def self_signed_cert_cb(_valid, _host)
Expand Down
2 changes: 1 addition & 1 deletion spec/models/git_repository_spec.rb
Expand Up @@ -14,7 +14,7 @@
it "default dirname" do
repo = FactoryBot.create(:git_repository,
:url => "http://www.example.com/repos/manageiq")
expect(repo.directory_name).to eq(File.join(MiqAeDatastore::GIT_REPO_DIRECTORY, 'repos/manageiq'))
expect(repo.directory_name).to eq(File.join(described_class::GIT_REPO_DIRECTORY, 'repos/manageiq'))
end

context "repo" do
Expand Down

0 comments on commit 96b4737

Please sign in to comment.