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
jnstq-acts_as_sms-0.1.1 test/vendor/plugins/rspec/failing_examples/partial_mock_example.rb
jnstq-acts_as_sms-0.1.3 test/vendor/plugins/rspec/failing_examples/partial_mock_example.rb
jnstq-acts_as_sms-0.1.4 test/vendor/plugins/rspec/failing_examples/partial_mock_example.rb
newbamboo-evented-rspec-1.1.12 examples/failing/partial_mock_example.rb
newbamboo-rspec-1.1.12 examples/failing/partial_mock_example.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/failing_examples/partial_mock_example.rb
merb-core-1.1.2 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/failing_examples/partial_mock_example.rb
merb-core-1.1.1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/failing_examples/partial_mock_example.rb
rspec-core-2.0.0.beta.9 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.8 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.7 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.6 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.5 example_specs/failing/partial_mock_example.rb
merb-core-1.1.0 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/failing_examples/partial_mock_example.rb
rspec-core-2.0.0.beta.4 example_specs/failing/partial_mock_example.rb
merb-core-1.1.0.rc1 spec10/public/webrat/test_app/gems/gems/rspec-1.1.11/failing_examples/partial_mock_example.rb
rspec-core-2.0.0.beta.3 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.2 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.beta.1 example_specs/failing/partial_mock_example.rb
rspec-core-2.0.0.a10 example_specs/failing/partial_mock_example.rb