Skip to content

Instantly share code, notes, and snippets.

@skmetz
Created December 30, 2008 13:51
Show Gist options
  • Save skmetz/41624 to your computer and use it in GitHub Desktop.
Save skmetz/41624 to your computer and use it in GitHub Desktop.
# If model Thing has fields name, description and photo ...
require File.join(File.dirname(__FILE__), '..', 'spec_helper.rb')
describe "resource(:things)" do
describe "a successful POST" do
before(:each) do
Thing.all.destroy!
file = File.new(File.join('path_to_test_photos',"thing_photo.jpg"))
params = {:name => 'foo', :description => 'cute AND testable', :photo => file}
@response = multipart_post(resource(:things), {:thing => params})
end
it "redirects to resource(:foos)" do
@response.should redirect_to(resource(Thing.first), :message => {:notice => "thing was successfully created"})
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment