ruby on rails - what changes to be made in spec_helper.rb to run my specs? -


i want restructure spec folder below :

-spec   -unit     -controller       -example.rb     -model   -integration     -controller     -model 

what changes have make in spec_helper.rb run specs in /spec/unit/controller/example.rb file.?

has ever tried restructuring specs based upon high level unit/integration etc.?

you don't have change in spec_helper.rb. do, however, need change example.rb example_spec.rb

this relevant line of code implements this, in /gems/rspec-rails-2.14.1/lib/rspec/rails/tasks/rspec.rake:

namespace :spec   types = begin     dirs = dir['./spec/**/*_spec.rb'].            map { |f| g=f.sub(/^\.\/(spec\/\w+)\/.*/, '\\1') ; puts ">>> found #{g}."; g }.            uniq.            select { |f| file.directory?(f) }     hash[dirs.map { |d| [d.split('/').last, d] }]   end 

so text in filename previous _spec.rb convention - doesn't change how rails processes files.


to run of specs, filter them in command line tags or text, or giving wanted root dir:

rspec . --example controller # runs tests have word 'controller' in them rsepc . --tag model # runs tests tagged 'model' => true rspec ./spec/unit # runs specs under ./spec/unit 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -