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 ...@@ -55,9 +55,13 @@ 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
before do
UI.warnings = '' 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]) user_target = stub(:name => 'SampleProject', :build_configurations => [target_config])
@target.stubs(:user_targets).returns([user_target]) @target.stubs(:user_targets).returns([user_target])
...@@ -66,37 +70,27 @@ module Pod ...@@ -66,37 +70,27 @@ module Pod
@integrator.unstub(:warn_about_xcconfig_overrides) @integrator.unstub(:warn_about_xcconfig_overrides)
@integrator.send(: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 ' \ UI.warnings.should.include 'The `SampleProject [Release]` target ' \
'overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting' 'overrides the `GCC_PREPROCESSOR_DEFINITIONS` build setting'
end end
it 'allows the use of the alternate form of the inherited flag' do it 'allows the use of the alternate form of the inherited flag' do
UI.warnings = '' @user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '${inherited}'] }
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])
@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.not.include 'GCC_PREPROCESSOR_DEFINITIONS' UI.warnings.should.not.include 'GCC_PREPROCESSOR_DEFINITIONS'
end end
it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do it 'allows build settings which inherit the settings form the CocoaPods xcconfig' do
UI.warnings = '' @user_target_build_settings = { 'GCC_PREPROCESSOR_DEFINITIONS' => ['FLAG=1', '$(inherited)'] }
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])
@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.not.include 'GCC_PREPROCESSOR_DEFINITIONS' 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