Sha256: 26d20de94c071d5b6ec12946f44115b790c1274bd4413992c90872c5b5a7abed

Contents?: true

Size: 583 Bytes

Versions: 3

Compression:

Stored size: 583 Bytes

Contents

require 'spec_helper'

class Bug1049Class

    def self.singleton
      @singleton ||= new
    end

    # Redirect all missing class methods to the singleton instance for backwards compatible API
    def self.method_missing(name,*args,&block)
      self.singleton.send(name,*args,&block)
    end

    def bar
      "abc"
    end
end

describe Bug1049Class do

  it "should mock correctly" do
    Bug1049Class.should_receive(:bar).and_return(123)
    Bug1049Class.bar.should == 123
  end

  it "should call successfully after a mock" do
    Bug1049Class.bar.should == "abc"
  end

end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
rspec-instructure-1.3.3 spec/spec/mocks/bug_report_1049_spec.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/rspec-1.3.2/spec/spec/mocks/bug_report_1049_spec.rb
rspec-1.3.2 spec/spec/mocks/bug_report_1049_spec.rb