I'm trying to do BDD on a Google App Script. I understand that in principle I should be able to use some combination of Cucumber, Capybara and Mechanize to do BDD on a non-rails external site. In this case I am trying to test a Google App Script I created.
I've got the complete code so far in this project:
https://github.com/tansaku/GoogleAppScriptBDD
However I am currently stuck on this error:
rack-test requires a rack application, but none was given (ArgumentError)
I know that I don't want to use rack, and I have been searching forums and stack overflow, and so far my best guess something like this in my cucumber env file:
require 'capybara/cucumber'
Capybara.run_server=false
Capybara.current_driver = :mechanize
Capybara.app_host = 'https://script.google.com/macros/s/AKfycbytA2xBsaQ0_FSJXNkPVXQekBnWD4hXPOaCjCT00wo/dev'
This SO post is relevant:
How to use Cucumber to test non-Ruby, non-Rack API's
But I would like to use Capybara since I am testing an HTML interface. Another alternative is described here:
http://blogs.kent.ac.uk/webdev/2012/08/02/using-capybara-webkit-with-cucumber-without-rails-or-rack/
and I've been following the discussion here:
https://groups.google.com/group/cukes/browse_thread/thread/297163800eaf2968
However I'd really like to understand how to just turn off the Rack thing, and I was hoping to use mechanize rather than the webkit described in the blog post mentioned above, since I understand mechanize better at the moment.
Anyhow, is there a best practice here, or do I just keep experimenting with alternatives?
What's kind of maddening is that the Capybara instructions here: https://github.com/jnicklas/capybara say that:
If you are not using Rails, set Capybara.app to your rack app:
Capybara.app = MyRackApp
but that generates a different error "uninitialized constant Object::MyRackApp (NameError) " and I'm not sure what MyRackApp is supposed to be, or where to find out (a general issue I have working with ruby :-/ ) should I be working through the cucumber or capybara source to find out what a MyRackApp is?
Anyway, thought I'd document all this here - any suggestions very much appreciated. I'd love to be able to BDD my google app scripts ...