-
-
Save anonymous/d4abda87a8af366b5953 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class String | |
def do_certain_parts_contain_a_number? | |
self.match /regex/ do |match| | |
'its a number!' if match.contains_a_number? # HOW TO I MOCK contains_a_number? HERE?! | |
end | |
end | |
end | |
RSpec.decribe String do | |
describe '#do_certain_parts_contain_a_number?' | |
it 'returns ' do | |
expect{ match }.to_receive(:contains_a_number?).and_return true # OR SOMETHING?! | |
expect{ 'acertainstring43'.do_certain_parts_contain_a_number? }.to eq 'its a number!' | |
end | |
end | |
end | |
NoMethodError: | |
undefined method `contains_a_number?' for "acertainstring43":String |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment