[Validator] Strip newlines from .swift-version files

parent 670952b5
......@@ -259,7 +259,7 @@ module Pod
#
def dot_swift_version
swift_version_path = file.dirname + '.swift-version'
swift_version_path.read if swift_version_path.exist?
swift_version_path.read.strip if swift_version_path.exist?
end
# @return [String] A string representing the Swift version used during linting
......
......@@ -867,6 +867,13 @@ module Pod
Pathname.any_instance.expects(:read).returns('1.0')
validator.dot_swift_version.should == '1.0'
end
it 'strips newlines from .swift-version files' do
validator = test_swiftpod
Pathname.any_instance.stubs(:exist?).returns(true)
Pathname.any_instance.stubs(:read).returns("2.1\n")
validator.swift_version.should == '2.1'
end
end
describe 'Getting the Swift value used by the validator' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment