2

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?

3 Answers 3

1

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.

Sign up to request clarification or add additional context in comments.

Comments

1

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.

2 Comments

This generates rspec controller specs with rails g controller but doesn't seem to affect rails g integration_test, at least with rails 3.1.1 (haven't tested earlier versions). The --integration-tools=rspec flag doesn't seem to have any effect either.
try rails g integration_test blah --integration-tool=rspec it's tool not tools
1

you should put in application.rb:

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

source: rails configuration guide

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.