Sha256: c2c75725d808fd204e11f783c09684b25e4545315da394843c9d2da030c87845

Contents?: true

Size: 659 Bytes

Versions: 14

Compression:

Stored size: 659 Bytes

Contents

require File.expand_path('../../spec_helper', __FILE__)

describe 'stub!' do
  it "is a terser way of creating an object and stubbing it" do
    object = stub!.some_method { 'value' }.subject
    expect(object.some_method).to eq 'value'
  end

  it "can be used inside the implementation block of a double" do
    object = Object.new
    stub(object).some_method { stub!.another_method { 'value' } }
    expect(object.some_method.another_method).to eq 'value'
  end

  it "can be called on a double" do
    object = Object.new
    stub(object).some_method.stub!.another_method { 'value' }
    expect(object.some_method.another_method).to eq 'value'
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
rr-3.1.1 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.1.0 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.9 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.8 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.7 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.6 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.5 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.4 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.3 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.2 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.1 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-3.0.0 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-1.2.1 spec/suites/rspec_2/functional/stub_bang_spec.rb
rr-1.2.0 spec/suites/rspec_2/functional/stub_bang_spec.rb