Sha256: 13efb35b4d2c630bd7b74589db236aef80fb4ac514fad9ae152ef014368af43a

Contents?: true

Size: 499 Bytes

Versions: 112

Compression:

Stored size: 499 Bytes

Contents

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

class MockableClass
  def self.find id
    return :original_return
  end
end

describe "A partial mock" do

  it "should work at the class level (but fail here due to the type mismatch)" do
    MockableClass.should_receive(:find).with(1).and_return {:stub_return}
    MockableClass.find("1").should equal(:stub_return)
  end

  it "should revert to the original after each spec" do
    MockableClass.find(1).should equal(:original_return)
  end

end

Version data entries

112 entries across 112 versions & 14 rubygems

Version Path
spree-0.8.1 vendor/plugins/rspec/examples/failing/partial_mock_example.rb
typo-5.0.1 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.0.2 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.0.3.98.1 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.0.3.98 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.0 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.1.1 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.1.2 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.1.3 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.1.98 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.1 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
typo-5.2 vendor/plugins/rspec/failing_examples/partial_mock_example.rb