Why doesn't selenium run before_filters in my application controller?
I've got a subdomained rails 3.0 app I'm trying to test with cucumber/capybara/selenium. I use the subdomain to set the current site in a before_filter in the application controller.
All my tests work fine, until I use the @javascript tag. The tests I run with @javascript don't run the before_filter and so the current site never gets set. The page doesn't load and 开发者_StackOverflow中文版the tests fail.
These same tests work as intended and produce the expected pages when I use save_and_open_page in the appropriate steps.
Anyone got any ideas as to why my before_filter isn't running under selenium?
My assessment that the filter wasn't running was incorrect. I was using puts statements to debug. In normal cucumber tests these go to the console window you run cucumber from. Because tests run with @javascript actually start up the application, the debug statements were getting sent to some unseen output. I was able to keep an eye on what was going on by replacing the puts statements with RAILS_DEFAULT_LOGGER.error and tailing the log file.
精彩评论