public
Created

  • Download Gist
OUTPUT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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
prospects_controller_test.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
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

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.

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.