[rspec-users] restful controllers with different content types
David Chelimsky
dchelimsky at gmail.com
Sat Apr 26 04:33:06 EDT 2008
On Apr 25, 2008, at 11:34 PM, "Adam Wiggins" <adam at heroku.com> wrote:
> Simplified example of a controller which takes a POST with a non-xml
> and non-form-urlencoded content type:
>
> class PhotosController < ApplicationController
> def create
> Photo.create :binary_data => request.body.read, :content_type =>
> 'image/jpg'
> head :ok
> end
> end
>
> How can I spec this? The way that I'd like to do it would be
> something like:
>
> it "creates a new photo from a posted image file" do
> Photo.should_receive(:create).with(:binary_data => 'the data',
> :content_type => 'image/jpg')
> post :create, :body => 'the data'
> end
What happens when you try this?
More information about the rspec-users
mailing list