mabounassif
mabounassif

Reputation: 2341

RSpec and testing Rails Gem

I'm trying to set a testing framework for a rails engine. I have everything working, I generated the corresponding rspec file with:

rails g rspec:install

However everytime I want to add a rspec testing file with:

rails g integration_test blah

The RSpec doesn't take over and instead the standard unit testing framework of rails creates the corresponding files. Any thoughts on where the problem might be?

Upvotes: 2

Views: 793

Answers (3)

frenesim
frenesim

Reputation: 703

you should put in application.rb:

    config.generators do |g|
      g.integration_tool :rspec
      g.test_framework :rspec
    end

source: rails configuration guide

Upvotes: 1

Antoine Joulie
Antoine Joulie

Reputation: 496

I solved that problem running rails g with --integration-tools option

rails g integration_test blah --integration-tools=rspec

I do not know how to set rspec as default tool.

Upvotes: 1

Cydonia7
Cydonia7

Reputation: 3826

I always add in my application.rb :

config.generators do |g|
  g.test_framework :rspec
end

That allows RSpec to replace Rails generator for tests.

Upvotes: 1

Related Questions