Sha256: 630786b0bf3ed822f206d8231f2251bbf02f2dde13d413e06be6fe917f376f3d

Contents?: true

Size: 990 Bytes

Versions: 106

Compression:

Stored size: 990 Bytes

Contents

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

describe "Mocker" do

  it "should be able to call mock()" do
    mock = mock("poke me")
    mock.should_receive(:poke)
    mock.poke
  end

  it "should fail when expected message not received" do
    mock = mock("poke me")
    mock.should_receive(:poke)
  end
  
  it "should fail when messages are received out of order" do
    mock = mock("one two three")
    mock.should_receive(:one).ordered
    mock.should_receive(:two).ordered
    mock.should_receive(:three).ordered
    mock.one
    mock.three
    mock.two
  end

  it "should get yelled at when sending unexpected messages" do
    mock = mock("don't talk to me")
    mock.should_not_receive(:any_message_at_all)
    mock.any_message_at_all
  end

  it "has a bug we need to fix" do
    pending "here is the bug" do
      # Actually, no. It's fixed. This will fail because it passes :-)
      mock = mock("Bug")
      mock.should_receive(:hello)
      mock.hello
    end
  end
end

Version data entries

106 entries across 106 versions & 13 rubygems

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