[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
Sun Nov 18 23:34:12 EST 2007


Bugs item #14475, was opened at 2007-10-05 06: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: Chad Humphries (spicycode)
Date: 2007-11-18 23:34

Message:
Moved to http://rspec.lighthouseapp.com/projects/5645-rspec/tickets/71-14475-tempfile-doesn-t-pass-be_an_instance_of-tempfile-maybe-becouse-it-use-decorator#ticket-71-2

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-10-05 09:56

Message:
It works - but you shouldn't have to switch the requires. I'd say its still a bug.

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

Comment By: Serhiy Boiko (cris)
Date: 2007-10-05 09:51

Message:
Thanks a lot.
Its work.

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

Comment By: David Chelimsky (dchelimsky)
Date: 2007-10-05 07: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