@JavaScript @sphinxFeature: Edit a service Scenario: Editing Given I exist as an "indivIDual" And I have few services as indivIDual user And Sphinx indexes all models ... Then I should see I18n translation for key "vIEws.messages.notices.add.updated"
@sphinx hook包含此逻辑:
Before('@sphinx') do self.use_transactional_fixtures = false ThinkingSphinx::Test.start sleep 2 # Give some time for sphinx to start.endAfter('@sphinx') do ThinkingSphinx::Test.stop self.use_transactional_fixtures = trueend
并且Sphinx索引所有模型包含:
Given(/^Sphinx indexes all models$/) do ThinkingSphinx::Test.index # Wait for Sphinx to finish loading in the new index files. sleep 0.25 until index_finished?end
这是database.yml:
development: adapter: postgresql database: my-project_development host: localhost enCoding: UTF8 pool: 5test: &test adapter: postgresql database: my-project_test<%= ENV['TEST_ENV_NUMBER'] %> username: my-project password: my-project host: localhost enCoding: UTF8 pool: 15
当我通过rake parallel运行我的规格:功能(通过parallel_tests)规格与思考sphinx总是失败:
Can't connect to MysqL server on '127.0.0.1' (61) (ThinkingSphinx::ConnectionError) /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/connection.rb:90:in `rescue in query' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/connection.rb:93:in `query' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/connection.rb:75:in `query_all' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/search/batch_inquirer.rb:17:in `block in results' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/connection.rb:37:in `block in take' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/innertube-1.1.0/lib/innertube.rb:138:in `take' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/connection.rb:35:in `take' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/search/batch_inquirer.rb:16:in `results' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/mIDdlewares/inquirer.rb:9:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `block in instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/search/context.rb:22:in `log' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/mIDdlewares/inquirer.rb:8:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/mIDdlewares/geographer.rb:11:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/mIDdlewares/sphinxql.rb:14:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/mIDdleware-0.1.0/lib/mIDdleware/runner.rb:31:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/mIDdleware-0.1.0/lib/mIDdleware/builder.rb:102:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/search.rb:67:in `populate' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/thinking-sphinx-3.1.0/lib/thinking_sphinx/search.rb:113:in `method_missing' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/squeel-1.1.1/lib/squeel/adapters/active_record/relation_extensions.rb:323:in `hash' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/squeel-1.1.1/lib/squeel/adapters/active_record/relation_extensions.rb:323:in `-' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/squeel-1.1.1/lib/squeel/adapters/active_record/relation_extensions.rb:323:in `merge_resolving_duplicate_squeel_equalitIEs' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/squeel-1.1.1/lib/squeel/adapters/active_record/relation_extensions.rb:45:in `merge' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/relation.rb:555:in `with_default_scope' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/relation.rb:582:in `exec_querIEs' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/relation.rb:471:in `load' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/relation.rb:220:in `to_a' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/relation.rb:565:in `blank?' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/core_ext/object/blank.rb:20:in `present?' /Users/serj/Projects/my-project/app/controllers/services_controller.rb:90:in `find_services' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:537:in `_run__1953055605195034856__process_action__callbacks' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80:in `run_callbacks' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/abstract_controller/callbacks.rb:17:in `process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal/rescue.rb:29:in `process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal/instrumentation.rb:31:in `block in process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `block in instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/notifications.rb:159:in `instrument' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal/instrumentation.rb:30:in `process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal/params_wrapper.rb:245:in `process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/railtIEs/controller_runtime.rb:18:in `process_action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/abstract_controller/base.rb:136:in `process' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/abstract_controller/rendering.rb:44:in `process' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal.rb:195:in `dispatch' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal/rack_delegation.rb:13:in `dispatch' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_controller/Metal.rb:231:in `block in action' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:80:in `dispatch' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:48:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:71:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `each' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/journey/router.rb:59:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/routing/route_set.rb:680:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-pjax-0.7.0/lib/rack/pjax.rb:12:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/request_store-1.0.5/lib/request_store/mIDdleware.rb:9:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/simple_captcha2-0.2.1/lib/simple_captcha/mIDdleware.rb:20:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/etag.rb:23:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/conditionalget.rb:25:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/head.rb:11:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/remotipart-1.2.1/lib/remotipart/mIDdleware.rb:27:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/params_parser.rb:27:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/flash.rb:241:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/session/abstract/ID.rb:225:in `context' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/session/abstract/ID.rb:220:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/cookies.rb:486:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/query_cache.rb:36:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activerecord-4.0.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/callbacks.rb:29:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:373:in `_run__4201420912784056511__call__callbacks' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/callbacks.rb:80:in `run_callbacks' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/callbacks.rb:27:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/remote_ip.rb:76:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/deBUG_exceptions.rb:17:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/show_exceptions.rb:30:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/cucumber-rails-1.4.0/lib/cucumber/rails/action_controller.rb:10:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/railtIEs-4.0.3/lib/rails/rack/logger.rb:38:in `call_app' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/railtIEs-4.0.3/lib/rails/rack/logger.rb:20:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:67:in `block in tagged' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:25:in `tagged' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/tagged_logging.rb:67:in `tagged' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/railtIEs-4.0.3/lib/rails/rack/logger.rb:20:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/request_ID.rb:21:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/methodoverrIDe.rb:21:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/runtime.rb:17:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/activesupport-4.0.3/lib/active_support/cache/strategy/local_cache.rb:83:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/actionpack-4.0.3/lib/action_dispatch/mIDdleware/static.rb:64:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/sendfile.rb:112:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/railtIEs-4.0.3/lib/rails/engine.rb:511:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/railtIEs-4.0.3/lib/rails/application.rb:97:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/builder.rb:138:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/urlmap.rb:65:in `block in call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `each' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/urlmap.rb:50:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/capybara-2.2.1/lib/capybara/server.rb:19:in `call' /Users/serj/.rvm/gems/ruby-2.0.0-p353@my-project/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in `service' /Users/serj/.rvm/rubIEs/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service' /Users/serj/.rvm/rubIEs/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run' /Users/serj/.rvm/rubIEs/ruby-2.0.0-p353/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
但是,如果我在非并行模式下运行这些失败的测试(我的意思是黄瓜路径/到/ my / test.rb),它可以工作(是的,parallel_tests适用于其他测试).我该如何解决这个问题呢?
解决方法 您需要配置config / thinking_sphinx.yml以在Sphinx文件的路径中包含该环境变量TEST_ENV_NUMBER – 文档的 deployment page中列出的设置应该是所需的设置,以及端口号(MysqL41设置).也许是这样的?test: MysqL41: <%= ENV['TEST_ENV_NUMBER'].to_i + 9307 %> pID_file: /path/to/app/tmp/searchd.<%= ENV['TEST_ENV_NUMBER' %>.pID indices_location: /path/to/app/db/sphinx/<%= ENV['TEST_ENV_NUMBER' %> configuration_file: /path/to/app/config/test.<%= ENV['TEST_ENV_NUMBER' %>.sphinx.conf binlog_path: /path/to/app/db/sphinx/<%= ENV['TEST_ENV_NUMBER' %>/binlog
我自己没有使用过这种方法(或者parallel_test),所以这肯定是猜测,但值得一试.
总结以上是内存溢出为你收集整理的ruby-on-rails – 如何在黄瓜测试中集成parallel_test和思考狮身人面像?全部内容,希望文章能够帮你解决ruby-on-rails – 如何在黄瓜测试中集成parallel_test和思考狮身人面像?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)