Sha256: 91166206a131da5dc0ae6d30bea4b5259813a43cdb9243d5b4880c423fb94880

Contents?: true

Size: 941 Bytes

Versions: 27

Compression:

Stored size: 941 Bytes

Contents

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

27 entries across 27 versions & 10 rubygems

Version Path
rspec-instructure-1.3.3 examples/failing/mocking_example.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/examples/failing/mocking_example.rb
rspec-1.3.2 examples/failing/mocking_example.rb
rspec-1.3.1 examples/failing/mocking_example.rb
rspec-1.3.1.rc examples/failing/mocking_example.rb
rspec-1.3.0 examples/failing/mocking_example.rb
simple-templater-0.0.1.4 gems/gems/rspec-1.2.9/examples/failing/mocking_example.rb
media-path-0.1.2 vendor/rspec/examples/failing/mocking_example.rb
simple-templater-0.0.1.3 vendor/rspec/examples/failing/mocking_example.rb
pupu-0.0.2.pre vendor/rspec/examples/failing/mocking_example.rb
media-path-0.1.1.pre vendor/rspec/examples/failing/mocking_example.rb
simple-templater-0.0.1.2 vendor/rspec/examples/failing/mocking_example.rb
media-path-0.1.1 vendor/rspec/examples/failing/mocking_example.rb
simple-templater-0.0.1.1 vendor/rspec/examples/failing/mocking_example.rb
pupu-0.0.2 vendor/rspec/examples/failing/mocking_example.rb
rango-0.0.6 vendor/rspec/examples/failing/mocking_example.rb
rango-0.1.pre vendor/rspec/examples/failing/mocking_example.rb
pupu-0.0.1 vendor/rspec/examples/failing/mocking_example.rb
media-path-0.1 vendor/rspec/examples/failing/mocking_example.rb
simple-templater-0.0.1 vendor/rspec/examples/failing/mocking_example.rb