Created
April 29, 2009 20:31
-
-
Save jeromegn/104034 to your computer and use it in GitHub Desktop.
This file contains 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
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | |
describe Participation::ArticlesController do | |
before(:each) do | |
activate_authlogic | |
@current_user = Factory.create(:user) | |
@article = Factory.build(:article) | |
@new_article = Factory.stub(:article) | |
end | |
describe :get => :new do | |
expects :new, :on => Article, :returns => @new_article | |
should_assign_to :article, :with => @new_article | |
end | |
describe :post => :create, :article => {:these => 'params'} do | |
expects :new, :on => Article, :with => {'these' => 'params'}, :returns => @article | |
describe "with valid params" do | |
expects :save, :on => @article, :returns => true | |
should_assign_to :article, :with => @article | |
should_redirect_to { edit_participation_article_path(@article) } | |
end | |
describe "with invalid params" do | |
expects :save, :on => @article, :returns => false | |
should_assign_to :article, :with => @article | |
should_render_template 'new' | |
end | |
end | |
end |
This file contains 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
2) | |
ScriptError in 'Participation::ArticlesController responding to #POST create with invalid params should assign article' | |
You have to give me :on as an option when calling :expects. | |
./spec/controllers/articles_controller_spec.rb:35: | |
./spec/controllers/articles_controller_spec.rb:32: | |
./spec/controllers/articles_controller_spec.rb:22: | |
./spec/controllers/articles_controller_spec.rb:3: | |
3) | |
ScriptError in 'Participation::ArticlesController responding to #POST create with invalid params should render template "new"' | |
You have to give me :on as an option when calling :expects. | |
./spec/controllers/articles_controller_spec.rb:36: | |
./spec/controllers/articles_controller_spec.rb:32: | |
./spec/controllers/articles_controller_spec.rb:22: | |
./spec/controllers/articles_controller_spec.rb:3: | |
4) | |
ScriptError in 'Participation::ArticlesController responding to #POST create with valid params should assign article' | |
You have to give me :on as an option when calling :expects. | |
./spec/controllers/articles_controller_spec.rb:28: | |
./spec/controllers/articles_controller_spec.rb:25: | |
./spec/controllers/articles_controller_spec.rb:22: | |
./spec/controllers/articles_controller_spec.rb:3: | |
5) | |
ScriptError in 'Participation::ArticlesController responding to #POST create with valid params should redirect to nil' | |
You have to give me :on as an option when calling :expects. | |
./spec/controllers/articles_controller_spec.rb:29: | |
./spec/controllers/articles_controller_spec.rb:25: | |
./spec/controllers/articles_controller_spec.rb:22: | |
./spec/controllers/articles_controller_spec.rb:3: | |
Finished in 0.418259 seconds | |
19 examples, 5 failures |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment