A model I'm trying to spec looks something like this

class MyClass
  def methodA
    do some stuff
    methodB
  end

  def methodB
    do some stuff
  end
end

my spec looks something like this:

x = MyClass.new
x.should_receive(:methodB)
lambda{ x.methodA }

In the situation outlined above, the spec fails.  But, if I change the
definition of methodA to be as follows the spec passes (note the addition of
"self" as the receiver):

def methodA
  do some stuff
  self.methodB
end


The code doesn't actually need for me to identify "self" as the receiver on
order for it to work.  But rSpec seems to require this.  Is there an
alternative way to write the spec so that it passes in the original case
(where I call methodB without an explicit receiver)?
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to