When I run the rspec using rspec-core/rspec from the root directory I get the following error
Failure/Error: require "main_folder/subfolder1/file_to_test.rb"
LoadError:
cannot load such file -- main_folder/subfolder1/file_to_test.rb
But I do require <absolute_path to file_to_test.rb> the load error goes away but I get a different error. Basically in all our files we use Sketchup::requirenow rspec will complain it does not know what isSketchup` how to get around this problem?
I don’t really want to test any SketchUp features. We have created the plugin in such a way that there is a certain part(we call it smart_engine) that does not use SketchUp, it contains only business logic and I want to write tests for that.
For Sketchup::require, you supply only the base name of the file, and it looks for extensions .rbe, .rbs, and.rb in that order. For the encrypted versions, it invokes the appropriate decryption loader to obtain plain Ruby to load.
… also, within the SketchUp Ruby environment, the path to several SketchUp version specific “Plugins” directories have been pushed onto the global $LOAD_PATH ($:) array so that relative paths (to an extension loader script, the 2nd constructor argument) can be resolved to a full path by both Sketchup::require or Kernel#require.
The appending of SketchUp “Plugins” paths will not happen outside SketchUp in a “plain-Jane” system Ruby process.
I ended up writing Testup2 test.
Q1: Is there a feature for writing a theory test.
Q2: Is there a better way to compare two JSON data. Right now I am comparing them just as a plain string.
Edit: I figured out the json compare but please respond to question 1.