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,9 +55,13 @@ module Pod
UI.warnings.should.include?('The Podfile does not contain any dependencies')
end
it 'check that the integrated target does not override the CocoaPods build settings' do
describe '#warn_about_xcconfig_overrides' do
before do
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] })
end
shared 'warn_about_xcconfig_overrides' do
target_config = stub(:name => 'Release', :build_settings => @user_target_build_settings)
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@target.stubs(:user_targets).returns([user_target])
......@@ -66,37 +70,27 @@ module Pod
@integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(:warn_about_xcconfig_overrides)
end
it 'check that the integrated target does not override the CocoaPods build settings' do
@user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1'] }
behaves_like '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
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] })
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@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)
@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
it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do
UI.warnings = ''
target_config = stub(:name => 'Release', :build_settings => { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] })
user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@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)
@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
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