Created
July 15, 2010 10:25
-
-
Save mallain/476774 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
mickael@mickael-laptop:~/projects/pabd/test$ ruby functional/commerce/commercial/prospects_controller_test.rb | |
* WARNING: 'test: logged in on GET to index should respond with success. ' is already defined | |
* WARNING: 'test: logged in on GET to index should render with the "application" layout. ' is already defined | |
* WARNING: 'test: logged in on GET to index should render template :index. ' is already defined | |
* WARNING: 'test: logged in on GET to index should not set the flash. ' is already defined | |
* WARNING: 'test: logged in on GET to new should respond with success. ' is already defined | |
* WARNING: 'test: logged in on GET to new should render with the "application" layout. ' is already defined | |
* WARNING: 'test: logged in on GET to new should render template :new. ' is already defined | |
* WARNING: 'test: logged in on GET to new should not set the flash. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (valid data) should assign @prospect with a kind of Prospect. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (valid data) should respond with redirect. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (valid data) should redirect to prospects index page. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (invalid data) should assign @prospect with a kind of Prospect. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (invalid data) should respond with success. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (invalid data) should render with the "application" layout. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (invalid data) should render template :new. ' is already defined | |
* WARNING: 'test: logged in on POST to :create (invalid data) should not set the flash. ' is already defined | |
* WARNING: 'test: logged in on GET to :show should respond with success. ' is already defined | |
* WARNING: 'test: logged in on GET to :show should render with the "application" layout. ' is already defined | |
* WARNING: 'test: logged in on GET to :show should render template :show. ' is already defined | |
* WARNING: 'test: logged in on GET to :show should not set the flash. ' is already defined | |
* WARNING: 'test: logged in on GET to :edit should respond with success. ' is already defined | |
* WARNING: 'test: logged in on GET to :edit should render with the "application" layout. ' is already defined | |
* WARNING: 'test: logged in on GET to :edit should render template :edit. ' is already defined | |
* WARNING: 'test: logged in on GET to :edit should not set the flash. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (valid data) should assign @prospect with a kind of Prospect. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (valid data) should respond with redirect. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (valid data) should redirect to prospects index page. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (invalid data) should assign @prospect with a kind of Prospect. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (invalid data) should respond with success. ' is already defined | |
* WARNING: 'test: logged in on PUT to :update (invalid data) should render template :edit. ' is already defined | |
* WARNING: 'test: logged in on DELETE to :destroy should assign @prospect. ' is already defined | |
* WARNING: 'test: logged in on DELETE to :destroy should respond with redirect. ' is already defined | |
* WARNING: 'test: logged in on DELETE to :destroy should redirect to prospects index page. ' is already defined | |
Loaded suite functional/commerce/commercial/prospects_controller_test | |
Started | |
................................. | |
Finished in 5.559221 seconds. | |
33 tests, 50 assertions, 0 failures, 0 errors |
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 'test_helper' | |
class Commerce::Commercial::ProspectsControllerTest < ActionController::TestCase | |
%w(fr en).each do |lang| | |
context "logged in" do | |
setup do | |
UserSession.create(Factory(:user)) | |
Factory(:agency) | |
Factory(:feedback) | |
@prospect = Factory.stub(:prospect) | |
@prospect.id = 1001 | |
I18n.locale = lang.to_sym | |
Prospect.stubs(:find).returns(@prospect) | |
Prospect.stubs(:find).with(:all, anything).returns([@prospect]) | |
end | |
should_get_action :index | |
should_get_action :new | |
context "on POST to :create (valid data)" do | |
setup do | |
Prospect.any_instance.expects(:save).returns(true).once | |
Prospect.any_instance.stubs(:id).returns(1001) | |
post :create, :prospect => {} | |
end | |
I18n.locale = lang.to_sym | |
should_assign_to :prospect, :class => Prospect | |
should_respond_with :redirect | |
should_redirect_to("prospects index page"){commerce_commercial_prospects_path} | |
end | |
context "on POST to :create (invalid data)" do | |
setup do | |
Prospect.any_instance.expects(:save).returns(false).once | |
post :create, :prospect => {} | |
end | |
should_assign_to :prospect, :class => Prospect | |
should_respond_with :success | |
should_render_with_layout | |
should_render_template :new | |
should_not_set_the_flash | |
end | |
context "on GET to :show" do | |
setup do | |
get :show, {:id => @prospect.id} | |
end | |
should_respond_with :success | |
should_render_with_layout | |
should_render_template :show | |
should_not_set_the_flash | |
end | |
context "on GET to :edit" do | |
setup do | |
get :edit, :id => @prospect.id | |
end | |
should_respond_with :success | |
should_render_with_layout | |
should_render_template :edit | |
should_not_set_the_flash | |
end | |
context "on PUT to :update (valid data)" do | |
setup do | |
@prospect.expects(:update_attributes).returns(true).once | |
put :update, :id => @prospect.id, :prospect => {} | |
end | |
should_assign_to :prospect, :class => Prospect | |
should_respond_with :redirect | |
should_redirect_to("prospects index page"){commerce_commercial_prospects_path} | |
end | |
context "on PUT to :update (invalid data)" do | |
setup do | |
@prospect.expects(:update_attributes).returns(false).once | |
put :update, :id => @prospect.id, :prospect => {} | |
end | |
should_assign_to :prospect, :class => Prospect | |
should_respond_with :success | |
should_render_template :edit | |
end | |
context "on DELETE to :destroy" do | |
setup do | |
@prospect.expects(:destroy).returns(true).once | |
delete :destroy, :id => @prospect.id | |
end | |
should_assign_to(:prospect){@prospect} | |
should_respond_with :redirect | |
should_redirect_to("prospects index page"){commerce_commercial_prospects_path} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With or without my loop %w(fr en).each do |lang| .. end there are 33 tests. So I think tests with "Warning" flag are not run.