Sha256: 16ae1b5e28284096dad821fd8a15843daf9dd1514215a4d50a00c36f7ac46897

Contents?: true

Size: 786 Bytes

Versions: 20

Compression:

Stored size: 786 Bytes

Contents

require 'spec_helper'

describe RSpecCandy::Helpers::StubExisting do

  describe Object do

    describe '#should_receive_and_return' do

      it 'should stub out the given methods with the given return values' do
        object = 'object'
        object.should_receive_and_return(:foo => 'foo', :bar => 'bar')
        object.foo.should == 'foo'
        object.bar.should == 'bar'
        object.size.should == 6 # object still responds to unstubbed methods
      end

      it 'should set expectations that all given methods are called' do
        (<<-example).should fail_as_example
          object = 'object'
          object.should_receive_and_return(:foo => 'foo', :bar => 'bar')
          object.foo
          # but not object.bar
        example
      end

    end

  end

end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rspec_candy-0.5.1 spec/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.5.0 spec/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.4.1 spec/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.4.0 spec/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.3.1 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.3.0 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.10 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.9 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.8 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.7 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.6 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.5 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.4 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.3 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.2 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.1 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.2.0 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.1.2 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.1.1 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb
rspec_candy-0.1.0 spec/shared/rspec_candy/helpers/should_receive_and_return_spec.rb