As I was working on several onebox engines (on a Windows environment)
I realized that I needed a better way to test urls. Console was ok at the beginning but then I realized how inconvenient it was. So I wrote a small script to help me with the process.
###Setup Development Environement
You can clone the deployer using git, or just copy paste it into a file.
> cd C:\development > git clone https://gist.github.com/lidlanca/b2cf30aeaef42bef1673 onebox-dev > cd onebox-dev
before running this you can change setup.rb testing template located in test_template_rb method see “Test a URL” section below for more information about what need or can be changed.
Then ask the deployer to pull the onebox code and setup the testing script.
> ruby setup-onebox-dev.rb --init all
###Test a URL
Before you start testing Onebox Urls
You can change path to external remote css file and chrome executable path in setup.rb
under the method test_template_rb and you do that before running:
ruby setup-onebox-dev.rb --init all
Setting the proper chrome path and css will open the test in the browser with proper styling.
Add URLS for testing
locate testMulti call at the end of the file (run-test.rb).
You can add multiple url to test in inside the %q() string
one url for each line
testMulti %q( -You can add http://url in multiple separate lines below https://github.com/discourse/discourse/blob/master/app/controllers/application_controller.rb#L1 ).lines , "multioutput.html"
run the test
when you run the test all onebox generated will be open in a chrome page ( if path to chrome was set properly)
> cd C:\development\onebox-dev > ruby run-test.rb
I have not documented how to get the onebox gems dependencies on windows.
before you can actually run any test you have to get the dependencies.
Personally I installed each missing gems on the go at my first install. based on the missing gem error.
you can see which gems are needed in onebox.gemspec