Rails LocalJumpError:没有给出块(yield)

时间:2012-01-26 05:25:59

标签: ruby-on-rails ruby

我的很多规格都给了我上述错误,但我不知道为什么。 ?

# Model
describe Notification do
  context "has valid db fields" do
    subject { Factory.build(:notification)}
    it { should be_valid }
    it { should have_column(:title).with_options(:null => false, :type => :string)}
    it { should have_column(:content).with_options(:null => false, :type => :string)}
    it { should have_column(:sent_at).with_options(:type => :date)}
    it { should have_column(:created_at).with_options(:null => false, :type => :date)}
    it { should have_column(:updated_at).with_options(:null => false, :type => :date)}
  end
end

堆栈追踪:

/home/me/.rvm/rubies/ruby-1.9.2-p290/bin/ruby -S rspec ./spec/models/notification_spec.rb failed
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/rake_task.rb:137:in `block (2 levels) in initialize'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:1112:in `verbose'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rspec-core-2.8.0/lib/rspec/core/rake_task.rb:127:in `block in initialize'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:636:in `block in execute'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:597:in `block in invoke_with_call_chain'
/home/me/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2029:in `block (2 levels) in top_level'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2029:in `block in top_level'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2001:in `block in run'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/me/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.8.7/bin/rake:31:in `<top (required)>'
/home/me/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/me/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

1 个答案:

答案 0 :(得分:1)

我认为这实际上是因为我的Gemfile中没有'shoulda'用于自定义匹配器!