当我使用任何基本匹配器运行这个简单的 RSpec 时,它不起作用:
describe "a simple RSpec matcher" do
true.should be_true
end
使用的任何匹配器的输出如下所示:
/private/tmp/rspec_matcher_test/matcher_spec.rb:3:in `block in <top (required)>': undefined local variable or method `be_true' for #<Class:0x007fdcd60ccb40> (NameError)
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:242:in `module_eval'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:242:in `subclass'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/example_group.rb:228:in `describe'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/dsl.rb:18:in `describe'
from /private/tmp/rspec_matcher_test/matcher_spec.rb:2:in `<top (required)>'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `block in load_spec_files'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `each'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/configuration.rb:819:in `load_spec_files'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/command_line.rb:22:in `run'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:80:in `run'
from /Users/jcuzella/.rvm/gems/ruby-1.9.3-p392/gems/rspec-core-2.13.1/lib/rspec/core/runner.rb:17:in `block in autorun'
(是的,我正在回答我自己的问题)