2019-07-30 21:29:24 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-05-31 17:39:16 +00:00
|
|
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
2018-05-31 16:21:34 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
2019-07-30 21:29:24 +00:00
|
|
|
RSpec.describe StaticController, type: :controller do
|
|
|
|
describe '.ccs' do
|
2018-05-31 16:21:34 +00:00
|
|
|
around(:each) do |example|
|
|
|
|
example.run
|
|
|
|
Settings.reload!
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'local_tar_gz' do
|
|
|
|
before (:each) do
|
|
|
|
Settings.merge!(
|
2019-07-30 21:29:24 +00:00
|
|
|
ccs: {
|
|
|
|
ccs_method: 'local_tar_gz'
|
|
|
|
}
|
|
|
|
)
|
2018-05-31 16:21:34 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'fails on git archive' do
|
|
|
|
expect(Kernel).to receive(:system).and_return(false)
|
|
|
|
get('ccs')
|
|
|
|
expect(response.status).to eq 500
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-08-02 16:46:09 +00:00
|
|
|
describe 'github' do
|
|
|
|
before (:each) do
|
|
|
|
Settings.merge!(
|
|
|
|
ccs: {
|
|
|
|
ccs_method: 'github',
|
|
|
|
options: {
|
|
|
|
account: 'account',
|
|
|
|
repo: 'repo'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'setup github' do
|
|
|
|
expect(File).to receive(:read).with("#{Rails.root}/CCS_HASH").and_return("hash\n")
|
|
|
|
get('ccs')
|
|
|
|
expect(response).to redirect_to 'https://github.com/account/repo/tree/hash'
|
|
|
|
end
|
2018-05-31 16:21:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|