Sha256: a1f125ad06507be746f3ed80e8103ae1110eb386a83ee54a08616353849dc1fd

Contents?: true

Size: 926 Bytes

Versions: 9

Compression:

Stored size: 926 Bytes

Contents

require "examples/example_helper"

describe RR, "#mock" do
  before do
    @subject = Object.new
  end

  it "creates a mock Double Scenario" do
    mock(@subject).foobar(1, 2) {:baz}
    @subject.foobar(1, 2).should == :baz
  end
end

describe RR, "#stub" do
  before do
    @subject = Object.new
  end

  it "creates a stub Double Scenario" do
    stub(@subject).foobar {:baz}
    @subject.foobar("any", "thing").should == :baz
  end
end

describe RR, "#mock and #probe" do
  before do
    @subject = Object.new
    def @subject.foobar
      :baz
    end
  end

  it "creates a probe Double Scenario" do
    mock.probe(@subject).foobar
    @subject.foobar.should == :baz
  end
end

describe RR, "#stub and #probe" do
  before do
    @subject = Object.new
    def @subject.foobar
      :baz
    end
  end

  it "creates a probe Double Scenario" do
    stub.probe(@subject).foobar
    @subject.foobar.should == :baz
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rr-0.3.2 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.0 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.3 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.4 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.1 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.6 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.5 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.7 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.8 examples/rr/rspec/rspec_usage_example.rb