I am working on a test suite that also compare loads of paths, e.g. something like that:
expect(all_classes).to contain_exactly(
File.expand_path("lib/#{plugin_info.actions_path}/#{plugin_name}_action.rb"),
File.expand_path("lib/#{plugin_info.helper_path}/#{plugin_name}_helper.rb")
)
Unfortunately on Windows, this sometimes causes test failures if the generated temporary paths contain a directory, that triggers 8.3 filenames. An example:
2018-09-11T20:52:42.9346535Z 1) Fastlane::PluginGenerator#generate creates a plugin.rb file for the plugin
2018-09-11T20:52:42.9346797Z Failure/Error:
2018-09-11T20:52:42.9347031Z expect(all_classes).to contain_exactly(
2018-09-11T20:52:42.9347330Z File.expand_path("lib/#{plugin_info.actions_path}/#{plugin_name}_action.rb"),
2018-09-11T20:52:42.9347673Z File.expand_path("lib/#{plugin_info.helper_path}/#{plugin_name}_helper.rb")
2018-09-11T20:52:42.9347922Z )
2018-09-11T20:52:42.9348040Z
2018-09-11T20:52:42.9348443Z expected collection contained: ["C:/Users/VSSADM~1/AppData/Local/Temp/d20180911-3656-1muipt1/fastlane-plugin-tester_thing/lib/fastla...muipt1/fastlane-plugin-tester_thing/lib/fastlane/plugin/tester_thing/helper/tester_thing_helper.rb"]
2018-09-11T20:52:42.9349108Z actual collection contained: ["C:/Users/VssAdministrator/AppData/Local/Temp/d20180911-3656-1muipt1/fastlane-plugin-tester_thing/li...muipt1/fastlane-plugin-tester_thing/lib/fastlane/plugin/tester_thing/helper/tester_thing_helper.rb"]
2018-09-11T20:52:42.9349732Z the missing elements were: ["C:/Users/VSSADM~1/AppData/Local/Temp/d20180911-3656-1muipt1/fastlane-plugin-tester_thing/lib/fastla...muipt1/fastlane-plugin-tester_thing/lib/fastlane/plugin/tester_thing/helper/tester_thing_helper.rb"]
2018-09-11T20:52:42.9350359Z the extra elements were: ["C:/Users/VssAdministrator/AppData/Local/Temp/d20180911-3656-1muipt1/fastlane-plugin-tester_thing/li...muipt1/fastlane-plugin-tester_thing/lib/fastlane/plugin/tester_thing/helper/tester_thing_helper.rb"]
2018-09-11T20:52:42.9350855Z # ./fastlane/spec/plugins_specs/plugin_generator_spec.rb:135:in `block (4 levels) in <top (required)>'
2018-09-11T20:52:42.9351199Z # ./fastlane/spec/plugins_specs/plugin_generator_spec.rb:119:in `chdir'
2018-09-11T20:52:42.9351541Z # ./fastlane/spec/plugins_specs/plugin_generator_spec.rb:119:in `block (3 levels) in <top (required)>'
In this case the problem lies in the path of the temp directory generated on a Azure DevOps pipelines machine: C:/Users/VssAdministrator/AppData/...
vs. C:/Users/VSSADM~1/AppData/...
Some of the ruby methods seem to return the long version, some others the short one. Complicating it seems that the same methods sometimes return the one, and then the other - depending on some context I didn't understand yet, at least that is how it seems to me after debugging the test failures a bit.
Can someone explain to me what is going on and any ideas how I can fix this? Is there a way to "standardize" everything on one "method" of representing a path?
Anything else I should read or look at to fix this?