Commit 10870e7f authored by Marius Rackwitz's avatar Marius Rackwitz

[Spec][Refactor] Move specs in subcontext and extracted shared behavior

To reduce code duplication
parent b6e5d736
...@@ -55,47 +55,41 @@ module Pod ...@@ -55,47 +55,41 @@ module Pod
UI.warnings.should.include?('The Podfile does not contain any dependencies') UI.warnings.should.include?('The Podfile does not contain any dependencies')
end end
it 'check that the integrated target does not override the CocoaPods build settings' do describe '#warn_about_xcconfig_overrides' do
UI.warnings = '' before do
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] }) UI.warnings = ''
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config]) end
@target.stubs(:user_targets).returns([user_target])
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
UI.warnings.should.include 'The `SampleProject [Release]` target ' \
'overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting'
end
it 'allows the use of the alternate form of the inherited flag' do shared 'warn_about_xcconfig_overrides' do
UI.warnings = '' target_config = stub(:name => 'Release', :build_settings => @user_target_build_settings)
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] }) user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config]) @target.stubs(:user_targets).returns([user_target])
@target.stubs(:user_targets).returns([user_target])
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' } @target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' }
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target]) @integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target])
@integrator.unstub(:warn_about_xcconfig_overrides) @integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides) @integrator.send(:warn_about_xcconfig_overrides)
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS' end
end
it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do it 'check that the integrated target does not override the CocoaPods build settings' do
UI.warnings = '' @user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] }
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] }) behaves_like 'warn_about_xcconfig_overrides'
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config]) UI.warnings.should.include 'The `SampleProject [Release]` target ' \
@target.stubs(:user_targets).returns([user_target]) 'overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting'
end
@target.xcconfigs['Release'] = { 'GCC_PREPROCESSOR_DEFINITIONS' => 'COCOAPODS=1' } it 'allows the use of the alternate form of the inherited flag' do
@integrator = UserProjectIntegrator.new(@podfile, config.sandbox, temporary_directory, [@target]) @user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] }
behaves_like 'warn_about_xcconfig_overrides'
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS'
end
@integrator.unstub(:warn_about_xcconfig_overrides) it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do
@integrator.send(:warn_about_xcconfig_overrides) @user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] }
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS' behaves_like 'warn_about_xcconfig_overrides'
UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS'
end
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