Commit d09f9b7
committed
test: add comprehensive unit tests for PropertyStruct
Analyzed ERB templates from 11+ Cloud Foundry repositories to identify
all real-world PropertyStruct usage patterns:
**Repositories Analyzed:**
- cloudfoundry/bosh (director, nats, postgres, health monitor, blobstore)
- cloudfoundry/routing-release (gorouter, route registrar, routing API, tcp router)
- cloudfoundry/uaa-release (OAuth, SAML, database configuration)
- pivotal/credhub-release (encryption providers, HSM integration)
- cloudfoundry/bosh-aws-cpi-release
- cloudfoundry/bosh-google-cpi-release (certificate handling)
- cloudfoundry/bosh-openstack-cpi-release
- cloudfoundry/bosh-vsphere-cpi-release
- cloudfoundry/bosh-warden-cpi-release
- cloudfoundry/bosh-docker-cpi-release
- cloudfoundry/bosh-virtualbox-cpi-release
**Comprehensive Test Coverage:**
Array Operations:
- .map(&:symbol), .map { block } - Transformations
- .select, .compact - Filtering nils/empty values
- .find - Finding elements by condition
- .flatten - Nested array flattening
- .any? - Predicate checking
- .include? - Membership testing
- .reject - Filtering with negation
- .uniq - Removing duplicates
- .first, .last - Array accessors
- .join - Array joining
Method Chaining:
- .to_yaml.gsub - Config generation with string processing
- .lines.map - Multiline text indentation
- .split - URL/string parsing
- .sort_by(&:to_s) - Mixed type sorting
Iteration Patterns:
- .each_with_index - Indexed iteration
Hash Operations:
- .keys.sort - Deterministic ordering
- .key? - Membership testing
- .values - Value extraction
- .merge - Combining hashes
String Conditionals:
- .start_with? - Prefix checking
- .empty?, .nil? - Empty/nil validation
- .gsub - Pattern replacement
- .index - Substring position
Type Conversions:
- .to_i, .to_s - Type conversions
These tests ensure PropertyStruct maintains 100% compatibility with
OpenStruct for all usage patterns found in production Cloud Foundry
deployments.
Related to rkoster/rubionic-workspace#2291 parent ae0b115 commit d09f9b7
1 file changed
+1211
-0
lines changed
0 commit comments