OzFramework / oz

Oz is a behavioral web-ui testing framework developed to reduce test maintenance by using a predictive model rather than a scriptive model when writing tests.
Apache License 2.0
23 stars 7 forks source link

Closes #155: Oz Loader #157

Closed Castone22 closed 5 years ago

Castone22 commented 5 years ago

Where to begin...

I honestly didn't like us polluting the global namespace in ruby as this is a pretty bad practice (at the moment i haven't disabled the methods that sit up in global in favor of backward compat, but they do give a VERY annoying deprecation warning whenever you use them, just ask Uriah, he got tired of it after about 3 runs.) . This impacts append_to_world, and the recursive require methods.

I also wanted to rewrite the loading logic to be a bit easier to translate into a config-like pattern, or maybe even a config.

In interest of backward compatibility, CORE still gets a setup.rb that redirects its loading to OzLoader if it's hit.

OzLoader has the concept of page_stores and project_modules at the moment, they're read only attributes in that you can't set them, however you can still interact with the internal arrays by using left shift or concat, as well as other array methods. I added logic to prevent people from leftshifting an array in (that's why we can use concat) so that we don't end up with multi-dimensional arrays when someone tries to call `OzLoader.project_modules << %w[foo bar baz]

OzLoader also brings a check gems method for OzModules that allows you to pass it a list of gems required to load a given module to check if they are present in the runner's loaded specs.

Among the other changes, i introduced PaveStones to CoreWorld to allow the defined CoreModules to be swapped out as necessary, there's some light documentation around this in the unit tests.

Finally i also added some unit testing.

Castone22 commented 5 years ago

To address a concern raised by @PanoramicPanda We do not need to update example at the moment (and in fact, we should verify that this is the case). This is because i tired to maintain the existing functionality, albeit with some warnings. Update of example can be a separate effort and definitely should be.

ThePROX commented 5 years ago

@Castone22 please check the travis errors.

Castone22 commented 5 years ago

Yeah, that's a unit test that i wrote to notify that there are no unit tests for loader at the moment

ThePROX commented 5 years ago

Ok... I'll merge.