On Fri, Apr 4, 2008 at 4:10 PM, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> On Fri, Mar 21, 2008 at 5:46 AM, David Chelimsky <[EMAIL PROTECTED]> wrote:
> >
> > On Fri, Mar 21, 2008 at 1:35 AM, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> > > On Thu, Mar 20, 2008 at 3:34 AM, Rick DeNatale <[EMAIL PROTECTED]>
> wrote:
> > > > On 3/20/08, Joe Van Dyk <[EMAIL PROTECTED]> wrote:
> > > > > What was the resolution on this? How do you people test uploads
> with
> > > > > rspec stories?
> > > >
> > > > I submitted a Rails patch to address the underlying problem
> > > > http://dev.rubyonrails.org/ticket/11091
> > > >
> > > > It got in as changeset 8978 and should be in edge rails.
> > >
> > > Would it be worth it to monkeypatch that patch into rspec?
> >
> > Why would we do that? It's already in edge rails.
>
> Because I can't upgrade to edge rails. And I want to be able to test
> file uploads.
>
> I've applied the 8978 changeset to my stable rails -- but I'm still
> unsure of how to test file uploads in the context of a rspec story.
> Normally, I'd use fixture_file_upload, but that method doesn't seem to
> be available in rspec. Do I need to do anything special?
>
> Is anyone testing file uploads with rspec stories?
Think I got it working, here's an example step:
When("$username uploads a picathon image") do |username|
params = { :media =>
ActionController::TestUploadedFile.new(RAILS_ROOT +
'/test/fixtures/files/image.jpg') }
@sessions[username].post user_uploads_path(@users[username]), params
@sessions[username].visits user_uploads_path(@users[username])
end
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users