Correct the Rails.root call
This commit is contained in:
parent
42376af35e
commit
28f5ae838a
2 changed files with 3 additions and 3 deletions
|
@ -9,7 +9,7 @@ class StaticController < ApplicationController
|
||||||
def ccs
|
def ccs
|
||||||
ccs_method = !Settings.ccs ? 'local_tar_gz' : Settings.ccs.ccs_method
|
ccs_method = !Settings.ccs ? 'local_tar_gz' : Settings.ccs.ccs_method
|
||||||
if (ccs_method == 'local_tar_gz')
|
if (ccs_method == 'local_tar_gz')
|
||||||
temp_file = "#{$RAILS_ROOT}/tmp/#{Time.current.to_i}.tar.gz"
|
temp_file = "#{Rails.root}/tmp/#{Time.current.to_i}.tar.gz"
|
||||||
result = Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD")
|
result = Kernel.system("git archive --format=tar.gz -o #{temp_file} HEAD")
|
||||||
if result
|
if result
|
||||||
send_file(temp_file, :type => "application/gzip")
|
send_file(temp_file, :type => "application/gzip")
|
||||||
|
@ -17,7 +17,7 @@ class StaticController < ApplicationController
|
||||||
render :nothing => true, :status => 500
|
render :nothing => true, :status => 500
|
||||||
end
|
end
|
||||||
elsif (ccs_method == 'github')
|
elsif (ccs_method == 'github')
|
||||||
git_hash = File.read("#{$RAILS_ROOT}/CCS_HASH")
|
git_hash = File.read("#{Rails.root}/CCS_HASH")
|
||||||
redirect_to "https://github.com/#{Settings.ccs.options.account}/#{Settings.ccs.options.repo}/tree/#{git_hash}"
|
redirect_to "https://github.com/#{Settings.ccs.options.account}/#{Settings.ccs.options.repo}/tree/#{git_hash}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ RSpec.describe StaticController, :type => :controller do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
expect(File).to receive(:read).with("#{$RAILS_ROOT}/CCS_HASH").and_return("hash\n")
|
expect(File).to receive(:read).with("#{Rails.root}/CCS_HASH").and_return("hash\n")
|
||||||
get('ccs')
|
get('ccs')
|
||||||
expect(response).to redirect_to "https://github.com/account/repo/tree/hash"
|
expect(response).to redirect_to "https://github.com/account/repo/tree/hash"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue