Unverified Commit 611432dd authored by Ben Asher's avatar Ben Asher Committed by Danielle Tomlinson

added specs

parent 7ff2b8ba
...@@ -88,6 +88,7 @@ module Pod ...@@ -88,6 +88,7 @@ module Pod
FileUtils.mkdir_p(tmp_directory) FileUtils.mkdir_p(tmp_directory)
FileUtils.cp_r(ROOT + 'spec/fixtures/spec-repos/test_repo/', tmp_directory) FileUtils.cp_r(ROOT + 'spec/fixtures/spec-repos/test_repo/', tmp_directory)
non_git_repo = tmp_directory + 'test_repo' non_git_repo = tmp_directory + 'test_repo'
FileUtils.rm(non_git_repo + '.git')
podfile = Podfile.new do podfile = Podfile.new do
platform :ios, '8.0' platform :ios, '8.0'
...@@ -661,6 +662,55 @@ module Pod ...@@ -661,6 +662,55 @@ module Pod
should.raise(Informative) { analyzer.analyze } should.raise(Informative) { analyzer.analyze }
end end
it 'raises when targets integrate the same swift pod but have different swift versions' do
podfile = Podfile.new do
source SpecHelper.test_repo_url
project 'SampleProject/SampleProject'
platform :ios, '8.0'
pod 'OrangeFramework'
target 'SampleProject'
target 'TestRunner'
end
podfile.target_definitions['SampleProject'].stubs(:swift_version).returns('3.0')
podfile.target_definitions['TestRunner'].stubs(:swift_version).returns('2.3')
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
should.raise Informative do
analyzer.analyze
end.message.should.match /The following pods are integrated into Swift targets that do not have the same Swift version:/
end
it 'does not raise when targets integrate the same pod but only one of the targets is a swift target' do
podfile = Podfile.new do
source SpecHelper.test_repo_url
project 'SampleProject/SampleProject'
platform :ios, '8.0'
pod 'OrangeFramework'
target 'SampleProject'
target 'TestRunner'
end
podfile.target_definitions['SampleProject'].stubs(:swift_version).returns('3.0')
# when the swift version is unset at the project level, but set in one target, swift_version is nil
podfile.target_definitions['TestRunner'].stubs(:swift_version).returns(nil)
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
lambda { analyzer.analyze }.should.not.raise
end
it 'does not raise when swift targets with different swift versions integrate a non-swift pod' do
podfile = Podfile.new do
source SpecHelper.test_repo_url
project 'SampleProject/SampleProject'
platform :ios, '8.0'
pod 'JSONKit'
target 'SampleProject'
target 'TestRunner'
end
podfile.target_definitions['SampleProject'].stubs(:swift_version).returns('3.0')
# when the swift version is set at the project level, but unset in one target, swift_version is empty
podfile.target_definitions['TestRunner'].stubs(:swift_version).returns('')
analyzer = Pod::Installer::Analyzer.new(config.sandbox, podfile)
lambda { analyzer.analyze }.should.not.raise
end
#--------------------------------------# #--------------------------------------#
it 'computes the state of the Sandbox respect to the resolved dependencies' do it 'computes the state of the Sandbox respect to the resolved dependencies' 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