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
picolena-0.1.3 rails_plugins/rspec/failing_examples/partial_mock_example.rb
picolena-0.1.4 rails_plugins/rspec/failing_examples/partial_mock_example.rb
picolena-0.1.5 rails_plugins/rspec/failing_examples/partial_mock_example.rb
picolena-0.1.6 rails_plugins/rspec/failing_examples/partial_mock_example.rb
picolena-0.1.7 rails_plugins/rspec/failing_examples/partial_mock_example.rb
picolena-0.1.8 rails_plugins/rspec/failing_examples/partial_mock_example.rb
pictrails-0.5.0 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.5.1 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.5 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.6 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.7 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.9 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
radiant-0.6.8 vendor/plugins/rspec/failing_examples/partial_mock_example.rb
rspec-0.0.10 failing_examples/partial_mock_example.rb
rspec-1.1.10 failing_examples/partial_mock_example.rb
rspec-1.1.11 failing_examples/partial_mock_example.rb
rspec-1.1.7 failing_examples/partial_mock_example.rb
rspec-1.1.6 failing_examples/partial_mock_example.rb
rspec-1.1.5 failing_examples/partial_mock_example.rb
rspec-1.1.4 failing_examples/partial_mock_example.rb