ruby-on-rails – RSpec引发分段错误

ruby-on-rails – RSpec引发分段错误,第1张

概述有时我的测试套件会无缘无故地抛出分段错误.这是输出: /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/query_methods.rb:268: [BUG] Bus Errorruby 1.9.3p392 (2013-02-22 revision 39386) [x8 有时我的测试套件会无缘无故地抛出分段错误.这是输出:

/Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/query_methods.rb:268: [BUG] Bus Errorruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0]-- Control frame information -----------------------------------------------c:0209 p:---- s:0839 b:0839 l:000838 d:000838 CFUNC  :-c:0208 p:0068 s:0835 b:0833 l:000832 d:000832 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/query_methods.rb:268c:0207 p:0031 s:0828 b:0828 l:000827 d:000827 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/query_methods.rb:260c:0206 p:0084 s:0825 b:0825 l:000824 d:000824 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/calculations.rb:196c:0205 p:0166 s:0818 b:0818 l:000817 d:000817 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/calculations.rb:159c:0204 p:0050 s:0811 b:0811 l:000810 d:000810 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/calculations.rb:58c:0203 p:0089 s:0806 b:0806 l:000805 d:000805 METHOD /Users/Test/DropBox/projects/rails/my_shop/app/models/line_item_decorator.rb:7c:0202 p:---- s:0802 b:0802 l:000801 d:000801 FINISHc:0201 p:---- s:0800 b:0800 l:000370 d:000799 IFUNC c:0200 p:0008 s:0798 b:0797 l:001cd0 d:000796 BLOCK  /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/calculations.rb:94c:0199 p:---- s:0794 b:0794 l:000793 d:000793 FINISHc:0198 p:---- s:0792 b:0792 l:000791 d:000791 CFUNC  :mapc:0197 p:0028 s:0789 b:0789 l:000788 d:000788 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activesupport-3.2.9/lib/active_support/core_ext/enumerable.rb:60c:0196 p:0030 s:0784 b:0784 l:001cd0 d:001cd0 METHOD /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/calculations.rb:94....

我们使用Spree Commerce与Ruby 1.9.3和Rails 3.2.9.这是Gemfile.lock:

GIT  remote: git://github.com/spree/spree.git  revision: 0d81ee0a2265797641ce90e120ea4fd8b085fc12  ref: 0d81ee0a2265797641ce90e120ea4fd8b085fc12  branch: 1-2-stable  specs:    spree (1.2.0)      spree_API (= 1.2.0)      spree_cmd (= 1.2.0)      spree_core (= 1.2.0)      spree_dash (= 1.2.0)      spree_promo (= 1.2.0)      spree_sample (= 1.2.0)    spree_API (1.2.0)      spree_core (= 1.2.0)    spree_cmd (1.2.0)      thor (>= 0.14.6)    spree_core (1.2.0)      activemerchant (= 1.28.0)      acts_as_List (= 0.1.4)      awesome_nested_set (= 2.1.4)      aws-sdk (~> 1.3.4)      cancan (= 1.6.7)      deface (>= 0.9.0)      ffaker (~> 1.12.0)      highline (= 1.6.11)      jquery-rails (~> 2.0)      kaminari (= 0.13.0)      money (= 5.0.0)      paperclip (~> 2.8)      rabl (= 0.7.2)      rails (~> 3.2.9)      ransack (~> 0.7.0)      select2-rails (~> 3.0)      state_machine (= 1.1.2)      stringex (~> 1.3.2)    spree_dash (1.2.0)      httparty (~> 0.8.1)      spree_core (= 1.2.0)    spree_promo (1.2.0)      spree_core (= 1.2.0)    spree_sample (1.2.0)      spree_core (= 1.2.0)GIT  remote: git://github.com/spree/spree_auth_devise  revision: d06f95d861d19547b407bc2e50b03667e5572ebd  branch: 1-2-stable  specs:    spree_auth_devise (1.2.0)      cancan (~> 1.6.7)      devise (~> 2.2.3)      devise-encryptable (= 0.1.1)      spree_coreGIT  remote: git://github.com/sunspot/sunspot.git  revision: 5488725cb2587973e7ff809f234eb437a76424f4  branch: master  specs:    sunspot (2.0.0)      pr_geohash (~> 1.0)      rsolr (~> 1.0.7)    sunspot_rails (2.0.0)      nokogiri      sunspot (= 2.0.0)    sunspot_solr (2.0.0)GIT  remote: https://github.com/Goltergaul/spree_i18n.git  revision: 98662fb03d250b920a0d8481fa6448bf56497474  specs:    spree_i18n (1.0.0)      i18n (~> 0.5)      spree (~> 1.1)GEM  remote: https://rubygems.org/  specs:    actionmailer (3.2.9)      actionpack (= 3.2.9)      mail (~> 2.4.4)    actionpack (3.2.9)      activemodel (= 3.2.9)      activesupport (= 3.2.9)      builder (~> 3.0.0)      erubis (~> 2.7.0)      journey (~> 1.0.4)      rack (~> 1.4.0)      rack-cache (~> 1.2)      rack-test (~> 0.6.1)      sprockets (~> 2.2.1)    active_utils (2.0.1)      activesupport (>= 2.3.11)      i18n    activemerchant (1.28.0)      active_utils (>= 1.0.2)      activesupport (>= 2.3.11)      builder (>= 2.0.0)      i18n      Json (>= 1.5.1)      money      nokogiri    activemodel (3.2.9)      activesupport (= 3.2.9)      builder (~> 3.0.0)    activerecord (3.2.9)      activemodel (= 3.2.9)      activesupport (= 3.2.9)      arel (~> 3.0.2)      tzinfo (~> 0.3.29)    activeresource (3.2.9)      activemodel (= 3.2.9)      activesupport (= 3.2.9)    activesupport (3.2.9)      i18n (~> 0.6)      multi_Json (~> 1.0)    acts_as_List (0.1.4)    addressable (2.3.4)    airbrake (3.1.11)      activesupport      builder      Json    akami (1.2.0)      gyoku (>= 0.4.0)      nokogiri (>= 1.4.0)    arel (3.0.2)    awesome_nested_set (2.1.4)      activerecord (>= 3.0.0)    aws-sdk (1.3.9)      httparty (~> 0.7)      Json (~> 1.4)      nokogiri (>= 1.4.4)      uuIDtools (~> 2.1)    bcrypt-ruby (3.0.1)    builder (3.0.4)    cancan (1.6.7)    cAPIstrano (2.15.2)      highline      net-scp (>= 1.0.0)      net-sftp (>= 2.0.0)      net-ssh (>= 2.0.14)      net-ssh-gateway (>= 1.1.0)    capybara (2.1.0)      mime-types (>= 1.16)      nokogiri (>= 1.3.3)      rack (>= 1.0.0)      rack-test (>= 0.5.4)      xpath (~> 2.0)    childprocess (0.3.9)      ffi (~> 1.0,>= 1.0.11)    choice (0.1.6)    chronic (0.9.1)    chunky_png (1.2.8)    climate_control (0.0.3)      activesupport (>= 3.0)    cocaine (0.5.2)      climate_control (>= 0.0.3,< 1.0)    coffee-rails (3.2.2)      coffee-script (>= 2.2.0)      railtIEs (~> 3.2.0)    coffee-script (2.2.0)      coffee-script-source      execJs    coffee-script-source (1.6.2)    colorize (0.6.0)    columnize (0.3.6)    compass (0.12.2)      chunky_png (~> 1.2)      fssm (>= 0.2.7)      sass (~> 3.1)    compass-rails (1.0.3)      compass (>= 0.12.2,< 0.14)    crack (0.3.2)    database_cleaner (0.9.1)    deBUGger (1.5.0)      columnize (>= 0.3.1)      deBUGger-linecache (~> 1.2.0)      deBUGger-ruby_core_source (~> 1.2.0)    deBUGger-linecache (1.2.0)    deBUGger-ruby_core_source (1.2.0)    deface (1.0.0)      colorize (>= 0.5.8)      nokogiri (~> 1.6.0)      rails (>= 3.1)    devise (2.2.3)      bcrypt-ruby (~> 3.0)      orm_adapter (~> 0.1)      railtIEs (~> 3.1)      warden (~> 1.2.1)    devise-encryptable (0.1.1)      devise (>= 2.1.0.rc)    devise-i18n (0.8.3)    diff-lcs (1.2.4)    ean (0.2.0)    email_spec (1.4.0)      launchy (~> 2.1)      mail (~> 2.2)    erubis (2.7.0)    eventmachine (1.0.3)    execJs (1.4.0)      multi_Json (~> 1.0)    factory_girl (4.2.0)      activesupport (>= 3.0.0)    factory_girl_rails (4.2.1)      factory_girl (~> 4.2.0)      railtIEs (>= 3.0.0)    fattr (2.2.1)    faye-websocket (0.4.7)      eventmachine (>= 0.12.0)    ffaker (1.12.1)    ffi (1.9.0)    fssm (0.2.10)    gyoku (1.0.0)      builder (>= 2.1.2)    haml (4.0.2)      tilt    highline (1.6.11)    hike (1.2.3)    http_parser.rb (0.5.3)    httparty (0.8.3)      multi_Json (~> 1.0)      multi_xml    httpi (2.0.2)      rack    i18n (0.6.5)    journey (1.0.4)    jquery-fileupload-rails (0.4.1)      actionpack (>= 3.1)      railtIEs (>= 3.1)    jquery-rails (2.3.0)      railtIEs (>= 3.0,< 5.0)      thor (>= 0.14,< 2.0)    Json (1.8.0)    kaminari (0.13.0)      actionpack (>= 3.0.0)      activesupport (>= 3.0.0)      railtIEs (>= 3.0.0)    launchy (2.3.0)      addressable (~> 2.3)    libv8 (3.11.8.17)    mail (2.4.4)      i18n (>= 0.4.0)      mime-types (~> 1.16)      treetop (~> 1.4.8)    mime-types (1.25)    mini_portile (0.5.1)    money (5.0.0)      i18n (~> 0.4)      Json    multi_Json (1.8.2)    multi_xml (0.5.5)    MysqL2 (0.3.11)    net-scp (1.1.0)      net-ssh (>= 2.6.5)    net-sftp (2.1.1)      net-ssh (>= 2.6.5)    net-ssh (2.6.7)    net-ssh-gateway (1.2.0)      net-ssh (>= 2.6.5)    newrelic_rpm (3.6.7.152)    nokogiri (1.6.0)      mini_portile (~> 0.5.0)    nori (2.1.0)    options (2.3.0)      fattr    orm_adapter (0.4.0)    paperclip (2.8.0)      activerecord (>= 2.3.0)      activesupport (>= 2.3.2)      cocaine (>= 0.0.2)      mime-types    poltergeist (1.2.0)      capybara (~> 2.1.0)      faye-websocket (~> 0.4,>= 0.4.4)      http_parser.rb (~> 0.5.3)    polyamorous (0.5.0)      activerecord (~> 3.0)    polyglot (0.3.3)    pr_geohash (1.0.0)    progress_bar (1.0.0)      highline (~> 1.6.1)      options (~> 2.3.0)    rabl (0.7.2)      activesupport (>= 2.3.14)      multi_Json (~> 1.0)    rack (1.4.5)    rack-cache (1.2)      rack (>= 0.4)    rack-ssl (1.3.3)      rack    rack-test (0.6.2)      rack (>= 1.0)    rails (3.2.9)      actionmailer (= 3.2.9)      actionpack (= 3.2.9)      activerecord (= 3.2.9)      activeresource (= 3.2.9)      activesupport (= 3.2.9)      bundler (~> 1.0)      railtIEs (= 3.2.9)    rails-erd (1.1.0)      activerecord (>= 3.0)      activesupport (>= 3.0)      choice (~> 0.1.6)      ruby-graphviz (~> 1.0.4)    rails-i18n (0.7.3)      i18n (~> 0.5)    railtIEs (3.2.9)      actionpack (= 3.2.9)      activesupport (= 3.2.9)      rack-ssl (~> 1.3.2)      rake (>= 0.8.7)      rdoc (~> 3.4)      thor (>= 0.14.6,< 2.0)    rake (10.1.0)    ransack (0.7.2)      actionpack (~> 3.0)      activerecord (~> 3.0)      polyamorous (~> 0.5.0)    rdoc (3.12.2)      Json (~> 1.4)    ref (1.0.4)    rsolr (1.0.9)      builder (>= 2.1.2)    rspec (2.13.0)      rspec-core (~> 2.13.0)      rspec-expectations (~> 2.13.0)      rspec-mocks (~> 2.13.0)    rspec-core (2.13.1)    rspec-expectations (2.13.0)      diff-lcs (>= 1.1.3,< 2.0)    rspec-mocks (2.13.1)    rspec-rails (2.13.0)      actionpack (>= 3.0)      activesupport (>= 3.0)      railtIEs (>= 3.0)      rspec-core (~> 2.13.0)      rspec-expectations (~> 2.13.0)      rspec-mocks (~> 2.13.0)    ruby-graphviz (1.0.8)    ruby-prof (0.13.0)    rubyzip (0.9.9)    sass (3.2.12)    sass-rails (3.2.6)      railtIEs (~> 3.2.0)      sass (>= 3.1.10)      tilt (~> 1.3)    savon (2.2.0)      akami (~> 1.2.0)      builder (>= 2.1.2)      gyoku (~> 1.0.0)      httpi (~> 2.0.2)      nokogiri (>= 1.4.0)      nori (~> 2.1.0)      wasabi (~> 3.1.0)    select2-rails (3.5.0)      thor (~> 0.14)    selenium-webdriver (2.35.1)      childprocess (>= 0.2.5)      multi_Json (~> 1.0)      rubyzip (< 1.0.0)      websocket (~> 1.0.4)    simple_form (2.1.0)      actionpack (~> 3.0)      activemodel (~> 3.0)    spree_skrill (1.0.2)      spree_core (>= 1.0.0)    spree_usa_epay (1.0.2)      savon      spree_core (>= 1.0.0)    sprockets (2.2.2)      hike (~> 1.2)      multi_Json (~> 1.0)      rack (~> 1.0)      tilt (~> 1.1,!= 1.3.0)    state_machine (1.1.2)    steak (2.0.0)      capybara (>= 1.0.0)      rspec-rails (>= 2.5.0)    stringex (1.3.3)    therubyracer (0.11.4)      libv8 (~> 3.11.8.12)      ref    thor (0.18.1)    tilt (1.4.1)    timecop (0.6.1)    treetop (1.4.15)      polyglot      polyglot (>= 0.3.1)    tunnels (1.2.2)      eventmachine    tzinfo (0.3.38)    uglifIEr (2.0.1)      execJs (>= 0.3.0)      multi_Json (~> 1.0,>= 1.0.2)    useragent (0.6.0)    uuIDtools (2.1.4)    vcr (2.5.0)    warden (1.2.1)      rack (>= 1.0)    wasabi (3.1.0)      httpi (~> 2.0)      nokogiri (>= 1.4.0)    webmock (1.8.11)      addressable (>= 2.2.7)      crack (>= 0.1.7)    websocket (1.0.7)    whenever (0.8.2)      activesupport (>= 2.3.4)      chronic (>= 0.6.3)    wicked_pdf (0.9.6)      rails    xpath (2.0.0)      nokogiri (~> 1.3)    zurb-foundation (4.1.2)      sass (>= 3.2.0)PLATFORMS  rubyDEPENDENCIES  airbrake  cAPIstrano  coffee-rails (~> 3.2.1)  compass-rails  database_cleaner  deBUGger (~> 1.5.0)  devise-encryptable  devise-i18n  ean  email_spec  factory_girl_rails  haml  httparty  jquery-fileupload-rails  jquery-rails  kaminari  launchy  MysqL2  newrelic_rpm  poltergeist  progress_bar  rails (= 3.2.9)  rails-erd  rails-i18n  rspec  ruby-prof  sass-rails (~> 3.2.3)  selenium-webdriver  simple_form  spree!  spree_auth_devise!  spree_i18n!  spree_ipayment!  spree_paypal_express!  spree_skrill  spree_usa_epay  spree_wirecard!  steak  sunspot_rails!  sunspot_solr!  therubyracer  timecop  tunnels  uglifIEr (>= 1.0.3)  useragent  vcr  webmock (~> 1.8.3)  whenever  wicked_pdf  zurb-foundation

有时它会抛出错误,有时它不会抛出错误,有时它甚至会由状态机gem中的某个文件引起.在line_item_decorator.rb:7只有一个数据库查询,没什么特别的.

我在Mac OS X 10.8.5上,但错误也发生在Ubuntu 13上.

知道如何解决这个问题吗?

解决方法 你在Mac上开发吗? Nokogiri是造成这些分段错误的宝石;这是Mac上一个非常常见的问题,特别是如果你安装了brew.

您可以查看在this url安装nokogiri的正确方法.

首先,从系统中卸载所有nokogiri版本:

gem uninstall nokogiri(select all)

接下来,如果你有brew,请尝试运行:

brew install libxml2 libxsltbrew link --force libxml2 libxslt

最后安装你需要的nokogiri版本(基于你的Gemfile,它是1.6.0):

gem install nokogiri --version 1.6.0 -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2  \                                     --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib  \                                     --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.28 \                                     --with-iconv-include=/usr/local/Cellar/libiconv/1.14/include  \                                     --with-iconv-lib=/usr/local/Cellar/libiconv/1.14/lib

最后,再次捆绑,您应该能够毫无问题地运行规范.

总结

以上是内存溢出为你收集整理的ruby-on-rails – RSpec引发分段错误全部内容,希望文章能够帮你解决ruby-on-rails – RSpec引发分段错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1283835.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-09
下一篇 2022-06-09

发表评论

登录后才能评论

评论列表(0条)

保存