[rspec-devel] [ rspec-Bugs-14475 ] Tempfile doesn't pass be_an_instance_of(Tempfile). Maybe becouse it use decorator

noreply at rubyforge.org noreply at rubyforge.org
Fri Oct 5 07:53:19 EDT 2007


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

Category: expectation module
Group: v1.0 (example)
Status: Open
Resolution: None
Priority: 3
Submitted By: Serhiy Boiko (cris)
>Assigned to: David Chelimsky (dchelimsky)
Summary: Tempfile doesn't pass be_an_instance_of(Tempfile). Maybe becouse it use decorator

Initial Comment:
describe "My problem" do

  it "should pass be_an_instance_of for newly created Tempfile" do
    # create test object
    xml_tempfile = Tempfile.new "object.xml"
    xml_tempfile.close
    # this kind of test passed normally
    xml_tempfile.class.should eql(Tempfile)
    # this doesn't pass
    xml_tempfile.should be_an_instance_of(Tempfile)
  end
end

In ruby-debug I found, that in validation stage, object become instance of File. Maybe something unwrap Delegator in Tempfile?

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

>Comment By: David Chelimsky (dchelimsky)
Date: 2007-10-05 11:53

Message:
This is related to http://rubyforge.org/tracker/index.php?func=detail&aid=11526&group_id=797&atid=3149.

Check this out - if you require in this order:

require 'spec'
require 'tempfile'

Then your example fails. However, if you require in this order:

require 'tempfile'
require 'spec'

Then the example passes!




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

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


More information about the rspec-devel mailing list