[Validator] Inform people of .swift-version on failure.

parent 93e847fd
...@@ -142,7 +142,12 @@ module Pod ...@@ -142,7 +142,12 @@ module Pod
reasons << 'all results apply only to public specs, but you can use ' \ reasons << 'all results apply only to public specs, but you can use ' \
'`--private` to ignore them if linting the specification for a private pod' '`--private` to ignore them if linting the specification for a private pod'
end end
reasons.to_sentence if dot_swift_version.nil?
reasons.to_sentence + ".\n[!] If you are trying to validate a Swift 3.0 Pod, " \
'you need to have a `.swift-version` file. e.g `echo "3.0" > .swift-version`'
else
reasons.to_sentence
end
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
......
...@@ -812,6 +812,19 @@ module Pod ...@@ -812,6 +812,19 @@ module Pod
validator.results.count.should == 0 validator.results.count.should == 0
end end
it 'tells users about the .swift-version file if the validation fails' do
Specification.any_instance.stubs(:deployment_target).returns('9.0')
validator = test_swiftpod
validator.stubs(:validated?).returns(false)
result = Validator::Result.new(:error, 'attribute', 'message')
validator.stubs(:results).returns([result])
validator.failure_reason.should == "1 error.\n[!] If you are trying" \
' to validate a Swift 3.0 Pod, you need to have a `.swift-version` ' \
'file. e.g `echo "3.0" > .swift-version`'
end
describe '#swift_version' do describe '#swift_version' do
it 'defaults to Swift 2.3' do it 'defaults to Swift 2.3' do
validator = test_swiftpod validator = test_swiftpod
......
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