Skip to content

Instantly share code, notes, and snippets.

@zporter
Created February 3, 2011 21:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zporter/810297 to your computer and use it in GitHub Desktop.
Save zporter/810297 to your computer and use it in GitHub Desktop.
Factory for Album model
Factory.define :album do |album|
album.name 'Album Name'
album.description 'Album Description'
album.active true
album.association :cover_image, :factory => :image
end
require File.dirname(__FILE__) + '/../spec_helper'
describe AlbumsController do
render_views
let(:album) { Factory(:album) }
it "update action should render edit template when model is invalid" do
admin_login
put :update, :id => album, :album => Factory.attributes_for(:album, :name => '')
response.should render_template(:edit)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment