Sha256: 6ca2ce5860d5ba446788565a2ab5172398614cde616b87cacc48e4442aeadbb2
Contents?: true
Size: 1.11 KB
Versions: 9
Compression:
Stored size: 1.11 KB
Contents
require 'spec_helper' describe 'integration with rspec-mocks' do let(:mp3) { Surrogate.endow(Class.new).define(:play) { |artist| }.new } it 'knows that rspec-mocks is loaded' do Surrogate::RSpec.rspec_mocks_loaded?.should equal true end context 'when rspec-mocks is loaded' do it 'uses their matchers' do mp3.play "Emily Wells" mp3.should have_been_told_to(:play).with(/emily/i) mp3.should_not have_been_told_to(:play).with(/emily/) mp3.play /regex/ mp3.should have_been_told_to(:play).with(/regex/) mp3.should_not have_been_told_to(:play).with(/xeger/) end end context 'when rspec-mocks is not loaded' do it 'does straight #== comparisons on each argument' do begin Surrogate::RSpec.rspec_mocks_loaded = false mp3.play "Emily Wells" mp3.should_not have_been_told_to(:play).with(/emily/i) mp3.play /regex/ mp3.should have_been_told_to(:play).with(/regex/) mp3.should_not have_been_told_to(:play).with(/xeger/) rescue Exception Surrogate::RSpec.rspec_mocks_loaded = true end end end end
Version data entries
9 entries across 9 versions & 1 rubygems