Skip to content

Instantly share code, notes, and snippets.

@mytrile
Created January 10, 2009 12:23
Show Gist options
  • Select an option

  • Save mytrile/45446 to your computer and use it in GitHub Desktop.

Select an option

Save mytrile/45446 to your computer and use it in GitHub Desktop.
def create
user = User.find_by_login(current_user.login)
@category = Category.new(params[:category])
if user.categories.create params[:category]
flash[:notice] = 'Category successfully added !'
redirect_to(categories_url)
else
flash[:notice] = 'There was an error processing your request'
redirect_to(categories_url)
end
end
context "on POST to :create " do
setup { post :create, :category => { :name => 'Cars', :description => 'I Like speed' } }
should_set_the_flash_to "Category successfully added !"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment