[yast-devel] WebYaST - broken 'test' mode setup in webservice plugin testsuites

I wanted to fix test-unit reloading when script/server finishes and I have found that mode 'test' is set quite late in plugin testsuites, after environment.rb is loaded. For this reason test ENV['RAILS_ENV'] == 'test' doesn't work there. The problem is in test_helper.rb files in plugins: # first config rails require File.expand_path(rails_parent + "/config/environment") # then enable testing, this will get the routing right ENV["RAILS_ENV"] = "test" When environment.rb is loaded the setup is: ENV["RAILS_ENV"] = nil RAILS_ENV = 'development' Jozef, this could be the reason why the host testsuite sometimes writes to the development DB during testing... I have fixed this problem in web-client and it's plugins, the webservice packages require more effort, because routing is set there. Reported as bug #533178 -- Best Regards Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/ -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org

Ladislav Slezak napsal(a):
I wanted to fix test-unit reloading when script/server finishes and I have found that mode 'test' is set quite late in plugin testsuites, after environment.rb is loaded.
For this reason test ENV['RAILS_ENV'] == 'test' doesn't work there.
The problem is in test_helper.rb files in plugins:
# first config rails require File.expand_path(rails_parent + "/config/environment") # then enable testing, this will get the routing right ENV["RAILS_ENV"] = "test"
When environment.rb is loaded the setup is:
ENV["RAILS_ENV"] = nil RAILS_ENV = 'development'
Jozef, this could be the reason why the host testsuite sometimes writes to the development DB during testing...
I have fixed this problem in web-client and it's plugins, the webservice packages require more effort, because routing is set there.
Reported as bug #533178
Good, it looks like you find root of problem.
--
Best Regards
Ladislav Slezák Yast Developer ------------------------------------------------------------------------ SUSE LINUX, s.r.o. e-mail: lslezak@suse.cz Lihovarská 1060/12 tel: +420 284 028 960 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz/
-- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
josef reidinger
-
Ladislav Slezak