[Validator] Use Pathname instead of File

parent b088c4c0
...@@ -247,7 +247,7 @@ module Pod ...@@ -247,7 +247,7 @@ module Pod
# #
def dot_swift_version def dot_swift_version
swift_version_path = file.dirname + '.swift-version' swift_version_path = file.dirname + '.swift-version'
File.read(swift_version_path) if File.exist?(swift_version_path) swift_version_path.read if swift_version_path.exist?
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -835,18 +835,14 @@ module Pod ...@@ -835,18 +835,14 @@ module Pod
describe '#dot_swift_version' do describe '#dot_swift_version' do
it 'looks for a .swift-version file' do it 'looks for a .swift-version file' do
validator = test_swiftpod validator = test_swiftpod
File.expects(:exist?).with do |arg| Pathname.any_instance.expects(:exist?)
arg.basename.to_s == '.swift-version'
end
validator.dot_swift_version validator.dot_swift_version
end end
it 'uses the .swift-version file if present' do it 'uses the .swift-version file if present' do
validator = test_swiftpod validator = test_swiftpod
File.stubs(:exist?).returns(true) Pathname.any_instance.stubs(:exist?).returns(true)
File.expects(:read).with do |arg| Pathname.any_instance.expects(:read).returns('1.0')
arg.basename.to_s == '.swift-version'
end.returns('1.0')
validator.dot_swift_version.should == '1.0' validator.dot_swift_version.should == '1.0'
end end
end end
......
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