Sha256: 070ae8516f4a2b539cb290e247c769639ff5b5bb5a1c562bc4cc9ba0819c3f5d

Contents?: true

Size: 642 Bytes

Versions: 20

Compression:

Stored size: 642 Bytes

Contents

require 'spec_helper'

describe RSpecCandy::Helpers::StubExisting do

  describe Object do

    describe '#stub_existing' do

      it 'should stub an existing method' do
        string = 'foo'
        string.stub_existing(:upcase => 'BAR', :downcase => 'bar')
        string.upcase.should == 'BAR'
        string.downcase.should == 'bar'
      end

      it 'should raise an error when attempting to stub a non-existing method' do
        string = 'foo'
        expect do
          string.stub_existing(:unknown => 'value')
        end.to raise_error('Attempted to stub non-existing method #unknown on "foo"')
      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/stub_existing_spec.rb
rspec_candy-0.5.0 spec/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.4.1 spec/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.4.0 spec/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.3.1 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.3.0 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.10 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.9 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.8 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.7 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.6 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.5 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.4 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.3 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.2 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.1 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.2.0 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.1.2 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.1.1 spec/shared/rspec_candy/helpers/stub_existing_spec.rb
rspec_candy-0.1.0 spec/shared/rspec_candy/helpers/stub_existing_spec.rb