Question for RubyMotion users: How to test in RubyMotion?
Right now we don't have any tests for the project in RubyMotion. Anybody have ideas on how to automatically test the project with RubyMotion? Thanks.
I'm not super familiar with RubyMotion, but I know it uses a miniature version of RSpec called Bacon to run tests. This is the RubyMotion documentation on testing.
Beyond that, I think there are a couple different ways you can go. First, you could just write a little RubyMotion app hit the endpoints that we want to test and then just write Bacon tests to test that the views render properly or something. I think this is kind of cumbersum though, because then you have two completely different test pools to maintain.
It looks like you can also set up your rakefile like:
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
$:.unshift("./lib/")
require './lib/dish'
Motion::Project::App.setup do |app|
end
task :spec do
App.config.spec_mode = true
spec_files = App.config.spec_files
App.config.instance_variable_set("@spec_files", spec_files)
Rake::Task["simulator"].invoke
end
and then run rake spec. I have no idea how accurate this is though.
Yeah. Thanks. Hmm, I'd like an automatic/continous service like Travis-CI for RubyMotion. Know if something like this exists?
We would also have to switch over to RSpec, which I think would be a good move. It's up to you though. If it is something that you think is worthwhile, we should probably do it sooner rather than later... our test pool is only going to grow! I do a ton of work with RSpec, so I could probably move over all the tests pretty quickly.
I agree using Travis CI is a good idea. Here is there blog post discussing testing of RubyMotion apps/gems.
That's great. RSpec is fine by me. Do you have the time for helping with this?
Definitely! I'm pretty swamped right now but I'll work in it over the next few says and then open a PR
Great. Thanks man :+1:
@tommyschaefer did you make any progress on converting the tests to RSpec? I'd like to be able to test with Travis so we can make changes ensured it will work. :)