> > You received this message because you are subscribed to the Google Groups
> > "rspec" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/rspec/64c0b722-7585-4903-8926-5a4d350a55
> > b3%40googlegroups.com
> > <https://groups.google.com/d/msgid/rspec/64c0b722-7585-4903-8926-5a4d350a
> > 55b3%40googlegroups.com?utm_medium=email&utm_source=footer> .
> > 
> > For more options, visit https://groups.google.com/d/optout.

Yes  `allow` is working correctly. 

require_relative "../test.rb"

describe Foo do
  before do
    allow(subject).to receive(:sum).and_return(12)
    allow(subject).to receive(:multiplication).and_return(1)
  end

  describe "#meth" do
    it "return an OpenStruct instance" do
      expect(subject.meth).to be_instance_of(OpenStruct)
    end
  end
end

The above code is working. Thanks for your help.

-- 
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, 
if you write the code as cleverly as possible, you are, by definition, not 
smart enough to debug it.

--Brian Kernighan

-- 
You received this message because you are subscribed to the Google Groups 
"rspec" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rspec/2736352.WRKszQ887W%40linux-wzza.site.
For more options, visit https://groups.google.com/d/optout.

Reply via email to