我就是这样做的
require 'spec_helper'
describe 'Donor' do
it "does something" do
d = Donor.new
d.name = 'ABC'
end
end
它失败了:
$> bundle exec rspec spec/tombamento/donor_spec.rb 2>&1 | head
/home/nerde/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sequel-4.10.0/lib/sequel/model/base.rb:2094: [BUG] Segmentation fault at 0x00000000000018
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0020 p:0129 s:0090 e:000089 METHOD /home/nerde/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sequel-4.10.0/lib/sequel/model/base.rb:2094
c:0019 p:0011 s:0084 e:000083 METHOD /home/nerde/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sequel-4.10.0/lib/sequel/model/base.rb:1171
c:0018 p:0014 s:0076 e:000074 METHOD /home/nerde/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/sequel-4.10.0/lib/sequel/model/base.rb:850
c:0017 p:0026 s:0071 e:000069 BLOCK /media/shared/home/git/unila/tombamento/spec/tombamento/donor_spec.rb:6 [FINISH]
...
我在续集宝石中找到了跟踪点的行:
begin
model.db.typecast_value(col_schema[:type], value)
rescue InvalidValue
调用model
方法时会出现问题。我使用debugger
上面的行,我可以毫无错误地调用model
:
2093 begin
2094 debugger
=> 2095 model.db.typecast_value(col_schema[:type], value)
2096 rescue InvalidValue
2097 raise_on_typecast_failure ? raise : value
2098 end
2099 end
(rdb:1) model
Donor
(rdb:1) model.db.typecast_value(col_schema[:type], value)
"ABC"
我也可以在控制台中成功运行此代码,但在运行规范时它会失败。
感谢您的帮助。
答案 0 :(得分:0)
重新安装Ruby解决了这个问题。