Topic: rspec: weird errorrrgggrr, and am I on the right track?

Hey gang,

I'm trying my luck in rSpec too, and was wondering whether I am on the right track. Am I speccing enough for this simple example?
Furthermore, I'm getting a weird error. Think expected 1, actual 1.

the class:

class Attachment < ActiveRecord::Base
    has_attachment :storage => :file_system,
                   :thumbnails => { :thumb => '100x100>' }
    validates_as_attachment

    def to_basecamp_file
      return { } if filename.blank?
        { :name => filename,
          :file => Basecamp::FileUpload.new(filename, File.read("public/#{ public_filename }")) }
    end
end


the spec:
require File.dirname(__FILE__) + '/../spec_helper'

describe Attachment do
  before(:each) do
    @attachment = Attachment.new(:filename => 'image.jpg')
  end

  it "should return correct data for to_basecamp_file" do
    vars = { :name => 'test', :content => 'data' }

    File.stub!(:read).and_return('data')
    File.should_receive(:read).once.and_return('data')
   
    Basecamp::FileUpload.stub!(:new).and_return(vars)
    Basecamp::FileUpload.should_receive(:new).once.and_return(vars)
   
    @attachment.to_basecamp_file.should eql({ :name => 'image.jpg', :file => vars })
  end
end


and last but not least, the error:
'Attachment should return correct data for to_basecamp_file' FAILED
expected {:name=>"image.jpg", :file=>{:content=>"data", :name=>"test"}}, got {:name=>"image.jpg", :file=>{:content=>"data", :name=>"test"}} (using .eql?)
./spec/models/attachment_spec.rb:17:
script/spec:4:

Anyone any ideas?

Re: rspec: weird errorrrgggrr, and am I on the right track?

In case anyone is watching, it should be:

@attachment.to_basecamp_file.should == { :name => 'image.jpg', :file => vars }

Aparently eql() is too strict.