Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- require_relative '../my_example'
- describe MyExample do
- let(:message_var) {"A message"}
- context 'when creating' do
- it 'should call message method with message_var' do
- expect_any_instance_of(MyExample).to receive(:message).with(message_var)
- MyExample.new(message_var)
- end
- it 'should call message method with message_var and return message_var in reverse' do
- expect_any_instance_of(MyExample).to receive(:message).with(message_var).and_return("this should fail")
- MyExample.new(message_var)
- end
- end
- end
- ../my_example
- class MyExample
- def initialize(m)
- message(m)
- end
- def message(m)
- return m.reverse
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement