How to run multiple Minitest files simultaneously from the terminal - ruby-on-rails

I currently have three ruby files containing tests written with Minitest, and I'd like to run them all at once but I've not had much luck. If I was using RSpec, I'd just do rspec spec/* and all the different tests would run as if from one big test file.
Things I've tried:
ruby test/game_test.rb test/board_test.rb test/player_test.rb
ruby test/*
Any help will be appreciated, thanks.

Related

Running bin/rails generate don't work

Im following a rails tutorial, and when im supposed to run the command: 'bin/rails generate model Article'. An error occurs saying that there isnt such a command.
I'm using 'command prompt with ruby on rails' and in the rails project i can find a Bin folder. Am also using windows 7.
Also What is the difference between running only 'rails generate' instead of running 'bin/rails generate'?
Using rails generate is fine if you have no bin stubs (binaries in the root /bin folder of your project). If you do have bin stubs then it's preferred to use them because they may do additional things specific to your project. But even then, it's (probably) fine to just use rails generate still. The other bin stubs may be a little more necessary to use, though (again, if present) because they tend to be shortcuts to e.g. bundle exec rake.
Rails 4.1 ships with bin stubs. That is, when you generate a Rails 4.1 project it generates bin stubs for you. So this is probably why your tutorial mentioned using them -- they're now there by default. But if you're on an older version of Rails that won't help you much.
The big reason Rails 4.1 includes bin stubs is because Rails uses spring by default now. Spring is an application preloader... that makes it so that when you call e.g. bin/rake ... it will load and keep a running rails environment in the background and then, the 2nd time you call bin/rake it will fork from the running environment giving you almost instantaneous response. So this is an example of "additional things specific to your project" that you get from using bin/rake over just rake and bin/rails over just rails.

Rake vs. Warbler in Ruby?

I have used Warble to make .war files. That worked pretty well.
Some of the tutorials online suggest using the "rake" command at various times. If rake is for compilation, I thought Ruby didn't need compilation. Is it a substitute for Warble? Or do these two play different functions?
When is rake meant to be used?
Rake is a tool written in Ruby for automating tasks, which you also write using a Ruby syntax. Ruby program's don't have to be built, but there are still plenty of other tasks involved in development that you can automate instead of doing yourself each time.
Some examples from Rails include migrating your database to a new schema or creating a new database.
Rake lets you write tasks with a Ruby syntax, and you can also specify dependencies between tasks, so that running one task will cause all of its dependencies to be ran first.
Think of rake as a make for Ruby. For example for one of the gems I develop, the Rakefile includes several tasks, like running all the tests (rake test) or building the gem (rake gem:build). More info on the web site:
http://rake.rubyforge.org/

Test already tested rails app with rspec and cucumber

I've started a project on rails, and so far I'm testing it using rails' built in test suite. Is there a way to start testing it using rspec and cucumber at this point? How to do this?
Thanks!
This is a really weird question. What do you mean you've been using Rails' built-in test suite? What version of Rails are you using?
To start with testing, say models, in RSpec, you invoke the following command in Rails 3:
rails generate rspec:model <ModelName>
In Rails 2.x:
script/generate rspec:model <ModelName>
Cucumber is a bit different, but it starts with (Rails 3):
rails generate cucumber:install
Rails 2.x:
script/generate cucumber
All of this information is easily accessible on their respective Github pages. Is there anything more specific you need?

Spork won't Find RoR Framework

I am learning rails by following the Rails Tutorial under Ubuntu. I have been using spork and autotest and following the TDD as suggested by the book.
At some point (which I can't tell) the autotest stopped refreshing on it's own and so I killed it, alongside spork to reboot them both (the book does say that happens and that you should reboot them) just like I had done couple of times before.
This time spork won't load and give me this error: "I can't find any testing frameworks to use. Are you running me from a project directory?" and there doesn't seem to be any documentation whatsoever.
What could it be?
P.S. I am running it from the project directory. I already tried the bundle install and bundle update commands, I also uninstalled the spork gem with gem uninstall spork and reinstalled it with bundler... nothing (Rebooting the computer does nothing as well XD).
I am using "RSpec" to run the test alongside "autotest". It seems that at some point I accidentally removed the rspec_helper.rb file (or something like that, I can't really recall the name of the file) and that was keeping both "spork" and "autotest" off.
Just had to re-run the generate scripts for RSpec and voilĂ . All worked like a charm.
P.S.: For sanity run your generate script in a project copy for the the generate script could replace some other files and brake some custom-made functionality.

Does Capybara require JRuby?

I'm building a Rails 3 app. I'm trying to learn Cucumber with Capybara.
Do I need JRuby to run Capybara via Cucumber?
I've used Webrat, but many people seem to be using Capybara,
so I'd love to try.
I don't need JavaScript testing right away, but I want to install
Capybara if I need in the end.
I read and read the Capybara documentation, but couldn't understand.
Capybara does not require jRuby or the Selenium-RC drivers.
Simply do the following to setup Cucumber with Capybara.
$ gem install capybara cucumber
$ rails generate cucumber --capybara
I haven't used Capybara myself, but from what I can glean from the readme, it doesn't look like it requires JRuby, depending on the JavaScript driver you use. For instance, if you want to use Culerity, then yes you need JRuby, since it needs to be in your path.
Are you having difficulty installing Capybara?

Resources