Reputation: 19969
I'd like to do something like the following:
require 'rspec-expectations'
"bat".length.should eq(3)
# => NoMethodError: undefined method `eq' for main:Object
Is something like this possible? How would I need to change it? Would I need to require 'rspec-expectations'
?
Upvotes: 0
Views: 109
Reputation: 7540
In irb:
require 'rspec-expectations'
include RSpec::Matchers
"bat".length.should eq(3)
Upvotes: 1
Reputation: 54704
Try interactive_rspec
:
gem install interactive_rspec
then
irspec
001> "bat".length.should eq(3)
.
Finished in 0.00006 seconds
1 example, 0 failures
=> true
Upvotes: 2