Sha256: 8a81dc7c7b805af5650c5d898b625433bf669384bee61e5f8c0b83e0e5267b2a

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

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

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

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rr-0.3.10 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.11 examples/rr/rspec/rspec_usage_example.rb
rr-0.3.9 examples/rr/rspec/rspec_usage_example.rb