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
dchelimsky-rspec-1.1.10 failing_examples/partial_mock_example.rb
dchelimsky-rspec-1.1.11.1 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.2 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.3 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.4 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.5 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.6 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.11.7 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.12 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.1 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.13 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.2 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.3 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.4 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.5 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.6 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.7 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.8 examples/failing/partial_mock_example.rb
dchelimsky-rspec-1.1.99.9 examples/failing/partial_mock_example.rb
jnstq-acts_as_sms-0.1.0 test/vendor/plugins/rspec/failing_examples/partial_mock_example.rb