Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move GIT_REPO_DIRECTORY constant from MiqAeDatastore #18669

Merged
merged 1 commit into from Apr 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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