Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想做类似以下的事情:
require 'rspec-expectations' "bat".length.should eq(3) # => NoMethodError: undefined method `eq' for main:Object
这样的事情可能吗?我需要如何更改它?我需要要求'rspec-expectations'吗?
'rspec-expectations'
尝试interactive_rspec:
interactive_rspec
gem install interactive_rspec
然后
irspec 001> "bat".length.should eq(3) . Finished in 0.00006 seconds 1 example, 0 failures => true
在 irb 中:
require 'rspec-expectations' include RSpec::Matchers "bat".length.should eq(3)