[rspec-devel] [ rspec-Bugs-9260 ] IvarProxy does not act like a hash

noreply at rubyforge.org noreply at rubyforge.org
Mon Apr 9 01:06:45 EDT 2007


Bugs item #9260, was opened at 2007-03-13 10:08
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=9260&group_id=797

Category: rails plugin
Group: None
>Status: Closed
Resolution: None
Priority: 3
Submitted By: Brian Takita (btakita)
Assigned to: Nobody (None)
Summary: IvarProxy does not act like a hash

Initial Comment:
undefined method `delete' for #<Spec::Rails::Expectations::IvarProxy:0xb6ede840>

This happened in a Helper Spec. Here is the code to reproduce this.

mab = Markaby::Builder.new(assigns_hash, self)

----------------------------------------------------------------------

Comment By: David Chelimsky (dchelimsky)
Date: 2007-04-02 19:20

Message:
Brian, can you please submit a failing example?

----------------------------------------------------------------------

Comment By: Brian Takita (btakita)
Date: 2007-03-13 10:13

Message:
Here is a fix I used without specs (my specs pass now):

class Spec::Rails::Expectations::IvarProxy
  def delete(name)
    @object.send(:remove_instance_variable, "@#{name}") if
@object.instance_variables.include?("@#{name}")
  end

  def each
    @object.instance_variables do |var|
      yield @object.instance_variable_get(var)
    end
  end
end

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=3149&aid=9260&group_id=797


More information about the rspec-devel mailing list