Hello,
Having problems testing a (working) upload in my Rails app (using 2.3.8):
class ProfilesControllerTest < ActionController::TestCase
  test "creates a new profile" do
    fixture_image = fixture_file_upload("#{RAILS_ROOT}/test/fixtures/files/avatar.jpg", 'image/jpeg')
    post :create, :profile=>{:username=>'johndoe', 
                             :password=>'mypass',
                             :avatar => fixture_image
                          }, :html => { :multipart => true }
    assert_response :success
    assert_not_nil Profile.find_by_username("johndoe")
    assert_not_nil Profile.find_by_username("johndoe").avatar
  end
end
The controller just assigns the params in bulk
@profile = Profile.new(params[:profile])
@profile.save
Model uses Joint to handle the uploads:
class Profile
  include MongoMapper::Document  
  plugin Joint
  attachment :avatar
end
Getting this error when running the test:
1) Error:
  test_creates_a_new_profile(Api::ProfilesControllerTest):
  TypeError: can't convert ActionController::TestUploadedFile into String
  (eval):15:in `size'
  (eval):15:in `avatar='
  /Users/oliver/.rvm/gems/ruby-1.8.7-p302/gems/mongo_mapper-0.8.6/lib/mongo_mapper/plugins/keys.rb:183:in `send'
What gives? Apparently the avatar= setter will deal with real uploaded files, but won't deal with TestUploadedFile's.