ruby - Are *all* specs for an engine expected to live in the dummy Rails app? -


i'm using rspec test engine models.

my preference test parts independent (dummy) app outside of app. i'd prefer have non-app tests live @ top level , not hidden in spec/dummy/spec.

the problem default (afaict) engine initializers aren't run if engine isn't mounted.

should go appears expected, i.e., put all specs in dummy app , run rspec dummy app's directory, when tests aren't related app whole?

or should run initializers top-level spec helper non-app specs? or other way?

if do, there dummy app repercussions?

if have dummy app, not have have specs in dummy app dir structure.

the following simplified version of permitters v0.0.1 uses.

in spec/spec_helper.rb:

env['rails_env'] = 'test' app_path = file.expand_path("../dummy", __file__) $load_path.unshift(app_path) unless $load_path.include?(app_path)  # if require rails, uninitialized constant actionview::template::handlers::erb::encoding_flag (nameerror) require 'rails/all' require 'config/environment' require 'db/schema' require 'rails/test_help' require 'rspec/rails'  # rspec config, etc. 

beyond that, want of modifications made in dummy app in spec/dummy either allow run in different versions of rails (3.1.x, 3.2.x, , 4.0.x) or because configuring things gem in dummy app.

i using appraisal gem , travisci continuous integration. setup i'm using allows me test in various versions of rails various versions of gems , not lot of maintenance overhead. needs little cleanup, works well.

if wanted not load rails environment set of specs (i.e. not load rails specs_, that. set env var in task definition in rakefile or @ command-line , in spec_helper.rb determine whether load things or not. have various rake tasks spawn new processes set env var or not depending on whether set of tests needs rails. wouldn't worry though if meant run in rails, unless need isolate it.

for more info on different ways test dummy apps, might see question: strategies gem tests ensure gem works rails 3.x , 4.0.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -