Skip to content

Commit

Permalink
Adds tests for cache key changes including resources.
Browse files Browse the repository at this point in the history
  • Loading branch information
jszumski committed Sep 29, 2022
1 parent 8a05442 commit 06d2dc9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions spec/unit/installer/project_cache/target_cache_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,25 @@ module ProjectCache
diff.should.equal(:project)
inverse_diff.should.equal(:project)
end

it 'should return inequality if an upstream pod changes resources' do
monkey_target = fixture_pod_target('monkey/monkey.podspec')
targets_by_label = Hash[([@banana_pod_target, monkey_target]).map { |target| [target.label, target] }]
@banana_cache_key = TargetCacheKey.from_pod_target(config.sandbox, targets_by_label, @banana_pod_target,
:is_local_pod => true)

# make up a new object to avoid the memoization of a target's resource_paths
monkey_target = fixture_pod_target('monkey/monkey.podspec')
monkey_target.file_accessors.first.stubs(:resource_bundles).returns('monkey_bundle' => ['Resources/**/*'])

targets_by_label = Hash[([@banana_pod_target, monkey_target]).map { |target| [target.label, target] }]
added_banana_cache_key = TargetCacheKey.from_pod_target(config.sandbox, targets_by_label, @banana_pod_target,
:is_local_pod => true)
diff = added_banana_cache_key.key_difference(@banana_cache_key)
inverse_diff = @banana_cache_key.key_difference(added_banana_cache_key)
diff.should.equal(:project)
inverse_diff.should.equal(:project)
end
end

describe 'key_difference with hash objects' do
Expand Down

0 comments on commit 06d2dc9

Please sign in to comment.