I would like to create a set of remote specs "specs/remote" that run with the RAILS_ENV = 'remote'. These specs need to use a different datab开发者_JS百科ase than the model specs. I would make them integration specs if that was easiest.
Ultimately, what is the easiest way change the RAILS_ENV from test and run a group of specs?
Create
remote.rbinconfig/environmentsTell rspec to use your custom environment by setting
export RAILS_ENV=remoteat the shell prompt.Add the
remoteenvironment to yourconfig/database.ymlwith the appropriate settings for your alternate database.
Don't forget you can use YAML to include one environments configuration within another:
base: &base
adapter: mysql
development:
database: dev_database
<<: *base
test:
database: test_databae
<<: *base
remote:
database: remote_databae
<<: *test
etc.
加载中,请稍侯......
精彩评论