How should I integrate RSpec with Rake, Rails and my existing tests?

Edit: fixed some wrong statements about Rspec rails directory structure Rspec usually puts its tests in a separate directory structure spec which looks like this: spec/ ├── controllers │  ├── pages_controller_spec. Rb │  └── users_controller_spec. Rb ├── helpers │  ├── pages_helper_spec.

Rb │  └── users_helper_spec. Rb ├── models │  └── user_spec. Rb ├── spec_helper.

Rb └── views ├── pages │  └── home.html. Haml_spec. Rb └── users ├── index.html.

Haml_spec. Rb └── show.html. Haml_spec.

Rb It has a separate directory for models, controllers, and views. I am not sure exactly how Test::Unit structures its directories, but this is the default directory structure for Rspec. Note the spec_helper.

Rb file. This file tells Rspec where to look for specs, and has a few other configuration options Your best bet is probably just to follow the rspec best practices for having a spec dir, and make your own rake task that runs both the unit tests and the rspec tests. Something like this: task :run_tests do system("rspec spec/") system("rake test:units") end That will run your rspec tests and then your Test::Unit tests in turn.

Edit: fixed some wrong statements about Rspec rails directory structure. Rspec usually puts its tests in a separate directory structure, spec/, which looks like this: spec/ ├── controllers │  ├── pages_controller_spec. Rb │  └── users_controller_spec.

Rb ├── helpers │  ├── pages_helper_spec. Rb │  └── users_helper_spec. Rb ├── models │  └── user_spec.

Rb ├── spec_helper. Rb └── views ├── pages │  └── home.html. Haml_spec.

Rb └── users ├── index.html. Haml_spec. Rb └── show.html.

Haml_spec. Rb It has a separate directory for models, controllers, and views. I am not sure exactly how Test::Unit structures its directories, but this is the default directory structure for Rspec.

Note the spec_helper. Rb file. This file tells Rspec where to look for specs, and has a few other configuration options.

Your best bet is probably just to follow the rspec best practices for having a spec dir, and make your own rake task that runs both the unit tests and the rspec tests. Something like this: task :run_tests do system("rspec spec/") system("rake test:units") end That will run your rspec tests and then your Test::Unit tests in turn.

Essentially your answer is telling me that rspec tests are a separate type of test altogether. Also, with this system of organization, it looks like there's no way to separate rspec tests that test only a single unit from those that serve as larger functional or integration tests. I'd like to be able to maintain this level of separation in my tests.

Having a single category of tests isn't acceptable for large projects like the one I'm working on. – Jeff Nov 23 '10 at 20:53 Rspec tests that test only your controller or model are unit tests, if they are well-done. They can test whatever you want them to test.

When you install the rspec_rails it assumes you want to test your models, views, controllers, and helpers as units. However, you could also create more tests to serve as functional tests. You are not limited to the directories that Rspec creates.

You could easily create a "functional" directory and put all your functional tests in there as well. – Jergason Nov 23 '10 at 22:35.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions