Skip to content

Instantly share code, notes, and snippets.

@mallain
Created July 12, 2010 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mallain/472423 to your computer and use it in GitHub Desktop.
Save mallain/472423 to your computer and use it in GitHub Desktop.
require 'test_helper'
class Hr::AlertCollaboratorsControllerTest < ActionController::TestCase
context "logged in" do
setup do
UserSession.create(Factory(:user))
Factory(:agency)
Factory(:feedback)
@alert_collaborator = Factory.stub(:alert_collaborator)
@alert_collaborator.id = 1001
AlertCollaborator.stubs(:find).returns(@alert_collaborator)
AlertCollaborator.stubs(:find).with(:all, anything).returns([@alert_collaborator])
end
should_get_action :index
should_get_action :new
context "on POST to :create (valid data)" do
setup do
AlertCollaborator.any_instance.expects(:save).returns(true).once
AlertCollaborator.any_instance.stubs(:id).returns(1001)
post :create, :alert_collaborator => {}
end
should_assign_to :alert_collaborator, :class => AlertCollaborator
should_respond_with :redirect
should_redirect_to("alert_collaborator index page"){hr_alert_collaborators_path}
end
context "on POST to :create (invalid data)" do
setup do
AlertCollaborator.any_instance.expects(:save).returns(false).once
post :create, :alert_collaborator => {}
end
should_assign_to :alert_collaborator, :class => AlertCollaborator
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 => @alert_collaborator.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 => @alert_collaborator.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
@alert_collaborator.expects(:update_attributes).returns(true).once
put :update, :id => @alert_collaborator.id, :alert_collaborator => {}
end
should_assign_to :alert_collaborator, :class => AlertCollaborator
should_respond_with :redirect
should_redirect_to("alert_collaborator index page"){hr_alert_collaborators_path}
end
context "on PUT to :update (invalid data)" do
setup do
@alert_collaborator.expects(:update_attributes).returns(false).once
put :update, :id => @alert_collaborator.id, :alert_collaborator => {}
end
should_assign_to :alert_collaborator, :class => AlertCollaborator
should_respond_with :success
should_render_template :edit
end
context "on DELETE to :destroy" do
setup do
@alert_collaborator.expects(:destroy).returns(true).once
delete :destroy, :id => @alert_collaborator.id
end
should_assign_to(:alert_collaborator){@alert_collaborator}
should_respond_with :redirect
should_redirect_to("alert_collaborator index page"){hr_alert_collaborators_path}
end
end
end
mickael@mickael-laptop:~/projects/pabd/test$ ruby functional/hr/alert_collaborators_controller_test.rb
Loaded suite functional/hr/alert_collaborators_controller_test
Started
...........EEEE..................
Finished in 5.916115 seconds.
1) Error:
test: logged in on GET to index should not set the flash. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936275_9516'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should not set the flash. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
2) Error:
test: logged in on GET to index should render template :index. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936275_254870'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should render template :index. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
3) Error:
test: logged in on GET to index should render with the "application" layout. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936275_383441'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should render with the "application" layout. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
4) Error:
test: logged in on GET to index should respond with success. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936275_617389'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should respond with success. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
33 tests, 46 assertions, 0 failures, 4 errors
mickael@mickael-laptop:~/projects/pabd/test$
mickael@mickael-laptop:~/projects/pabd/test$ ruby functional/hr/alert_collaborators_controller_test.rb
Loaded suite functional/hr/alert_collaborators_controller_test
Started
.................................
Finished in 5.876578 seconds.
33 tests, 50 assertions, 0 failures, 0 errors
mickael@mickael-laptop:~/projects/pabd/test$ ruby functional/hr/alert_collaborators_controller_test.rb
Loaded suite functional/hr/alert_collaborators_controller_test
Started
...........EEEE..................
Finished in 6.033178 seconds.
1) Error:
test: logged in on GET to index should not set the flash. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936930_784222'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should not set the flash. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
2) Error:
test: logged in on GET to index should render template :index. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936931_35949'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should render template :index. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
3) Error:
test: logged in on GET to index should render with the "application" layout. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936931_162870'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should render with the "application" layout. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
4) Error:
test: logged in on GET to index should respond with success. (Hr::AlertCollaboratorsControllerTest):
ActionView::TemplateError: undefined method `just_raise_that_exception' for I18n:Module
On line #13 of app/views/hr/alert_collaborators/index.html.erb
10: <% @alert_collaborators_agency.each do |hr_alert| %>
11: <tr>
12: <td><%=h hr_alert.collaborator.full_name %></td>
13: <td><%= link_to I18n.t('action_show_ERROR_TRANSLATION'), hr_alert_collaborator_path(hr_alert) %></td>
14: <td><%= link_to t('action_edit'), edit_hr_alert_collaborator_path(hr_alert) %></td>
15: <td><%= link_to t('action_destroy'), hr_alert_collaborator_path(hr_alert), :confirm => t('action_are_you_sure'), :method => :delete %></td>
16: </tr>
app/views/hr/alert_collaborators/index.html.erb:13
app/views/hr/alert_collaborators/index.html.erb:10:in `each'
app/views/hr/alert_collaborators/index.html.erb:10
vendor/gems/resource_controller-0.6.6/lib/resource_controller/helpers/internal.rb:12:in `response_for'
vendor/gems/resource_controller-0.6.6/lib/resource_controller/actions.rb:7:in `index'
/test_helper.rb:60:in `__bind_1278936931_413045'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `call'
shoulda (2.10.3) lib/shoulda/context.rb:380:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `each'
shoulda (2.10.3) lib/shoulda/context.rb:379:in `run_current_setup_blocks'
shoulda (2.10.3) lib/shoulda/context.rb:361:in `test: logged in on GET to index should respond with success. '
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
/usr/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
/usr/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:67:in `start_mediator'
/usr/lib/ruby/1.8/test/unit/ui/console/testrunner.rb:41:in `start'
/usr/lib/ruby/1.8/test/unit/ui/testrunnerutilities.rb:29:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:216:in `run'
/usr/lib/ruby/1.8/test/unit/autorunner.rb:12:in `run'
/usr/lib/ruby/1.8/test/unit.rb:279
functional/hr/alert_collaborators_controller_test.rb:4
33 tests, 46 assertions, 0 failures, 4 errors
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
require 'factory_girl'
require 'shoulda'
require 'faker'
require "authlogic/test_case"
require 'i18n'
class ActiveSupport::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test database remains unchanged so your fixtures don't have to be reloaded
# between every test method. Fewer database queries means faster tests.
#
# Read Mike Clark's excellent walkthrough at
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
#
# Every Active Record database supports transactions except MyISAM tables
# in MySQL. Turn off transactional fixtures in this case; however, if you
# don't care one way or the other, switching from MyISAM to InnoDB tables
# is recommended.
#
# The only drawback to using transactional fixtures is when you actually
# need to test transactions. Since your test is bracketed by a transaction,
# any transactions started in your code will be automatically rolled back.
self.use_transactional_fixtures = true
# Instantiated fixtures are slow, but give you @david where otherwise you
# would need people(:david). If you don't want to migrate your existing
# test cases which use the @david style and don't mind the speed hit (each
# instantiated fixtures translates to a database query per test method),
# then set this back to true.
self.use_instantiated_fixtures = false
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
#
# Note: You'll currently still have to declare fixtures explicitly in integration tests
# -- they do not yet inherit this setting
#fixtures :all
end
module I18n
def just_raise_that_exception(*args)
raise args.first
end
end
class ActionController::TestCase
setup :activate_authlogic
I18n.exception_handler = :just_raise_that_exception
Factory(:agency) unless Agency.first.nil?
Factory(:feedback) unless Feedback.first.nil?
end
def should_get_action(action)
context "on GET to #{action}" do
setup do
get action
end
should_respond_with :success
should_render_with_layout
should_render_template action
should_not_set_the_flash
end
end
@mallain
Copy link
Author

mallain commented Jul 12, 2010

In this context, Exception is raise, but there is a problem about "undefined method `just_raise_that_exception'".
And in a second hand, why i must specify I18n.t whereas #t method is an alias ? isn't it ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment