Created
January 10, 2009 12:23
-
-
Save mytrile/45446 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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