Sha256: 21737cc5ea28bebe2f33fe906436ccfcd7b79d888daad4817eadfcb01c15b3f1

Contents?: true

Size: 965 Bytes

Versions: 1

Compression:

Stored size: 965 Bytes

Contents

require File.dirname(__FILE__) + '/../spec_helper.rb'

describe 'Stubbing Error' do

  behaves_like 'has standard setup'

  it 'should not be raised when stubbing module' do
    should.not.raise(CrossStub::Error) {
      AnyModule.xstub(:say_hello => 'i say hello')
    }
  end

  it 'should not be raised when stubbing class' do
    should.not.raise(CrossStub::Error) {
      AnyClass.xstub(:say_hello => 'i say hello')
    }
  end

  it 'should not be raised when stubbing nested class' do
    should.not.raise(CrossStub::Error) {
      AnyClass::Inner.xstub(:say_hello => 'i say hello')
    }
  end

  it 'should not be raised when stubbing nested module' do
    should.not.raise(CrossStub::Error) {
      AnyModule::Inner.xstub(:say_hello => 'i say hello')
    }
  end

  it 'should be raised when stubbing instance' do
    should.raise(CrossStub::CannotStubInstanceError) do
      o = AnyClass.new
      o.xstub(:say_hello => 'i say hello')
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cross-stub-0.1.4 spec/cross-stub/stubbing_error_spec.rb