kurenn / market_place_api

The API on Rails tutorial application
142 stars 70 forks source link

Chapter 6 - Rspec-rails should be "group :development, :test" #48

Open ACPK opened 8 years ago

ACPK commented 8 years ago

In the end of Chapter 6, the 'rspec-rails' gem is in "group :test". I'd recommend adding it to "group :development, :test" so that it works for rake tasks and generators.

See: https://github.com/rspec/rspec-rails#installation

kurenn commented 8 years ago

I'll include it on next version of the book, you can always send me a pull request ;)

leo-le-07 commented 8 years ago

I'm a new rubyist so I don't know what is the difference between test and development group ? What will happen if we have only test or development group ? Thanks

kurenn commented 8 years ago

It is just a way to organize your gems, which are dependencies which your application rely on.

In rails you have minimum 3 environments, development, test and production, and this is important in this case because the group where you add the gems are the ones where they are going to be actually require.

For development purposes you don't have to worry about it, everything works as expected, the caveat comes with production, if you deploy to production, let's say on heroku, you will see that when it runs the bundle command it runs something like:

bundle install --without test development

This is because you are not actually going to use a factory gem to create your data as with testing for example.