Skip to content

Commit

Permalink
Fix last version to strip also newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
jimirocks committed Apr 16, 2020
1 parent 00db9aa commit 6dc898a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/functions/rclone/last_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def last_version
uri = URI('https://downloads.rclone.org/version.txt')
Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
response = http.request Net::HTTP::Get.new(uri)
response.body.gsub(%r{.*rclone v(\d+\.\d+\.\d+).*}, '\1')
response.body.gsub(%r{.*rclone v(\d+\.\d+\.\d+).*}m, '\1')
end
end
end
2 changes: 1 addition & 1 deletion spec/classes/rclone_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
let(:params) { { ensure: 'latest' } }

before(:each) do
stub_request(:get, 'https://downloads.rclone.org/version.txt').to_return(body: 'rclone v1000.0.1')
stub_request(:get, 'https://downloads.rclone.org/version.txt').to_return(body: "rclone v1000.0.1\n")
end

it { is_expected.to contain_class('rclone::install') }
Expand Down
2 changes: 1 addition & 1 deletion spec/functions/last_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe 'rclone::last_version' do
before(:each) do
stub_request(:get, 'https://downloads.rclone.org/version.txt').to_return(body: 'rclone v1000.0.1')
stub_request(:get, 'https://downloads.rclone.org/version.txt').to_return(body: "rclone v1000.0.1\n")
end

it { is_expected.to run.and_return('1000.0.1') }
Expand Down

0 comments on commit 6dc898a

Please sign in to comment.