NameError: undefined local variable or method `app' for - Rails 5.1.6 upgraded











up vote
0
down vote

favorite












I got this error in rspec while I do not have any variable or method with that name, I even searched all over the project. This happens when I run Rspec for all the test cases, while individual test cases work fine.



I was upgrading the ruby on rails version from ruby 2.3.3 rails 4.1.6. and I upgraded the version one by one, and I have all test passed after reaching rails 5.1.6 with ruby 2.4.5 I got this error. while all the tests also worked normally with the same ruby version and rails 5.0.7



Please let me know if you have any idea how to solve this.



I rebuild the spec_helper.rb again using bin/rspec --init and I added the dependencies and I have a longer trace now



NameError:
undefined local variable or method `app' for #<Devise::Mailer:0x00007fd3271928f8>
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:30:in `build_rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:26:in `rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:41:in `build_rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:37:in `rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:45:in `current_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/helpers/controller_helper.rb:18:in `assign_controller'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/base.rb:211:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/action_dispatch/routing/url_for.rb:106:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `new'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `view_context'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:97:in `_render_template'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:83:in `render_to_body'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/rendering.rb:24:in `render'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:945:in `block in collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `map'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:927:in `collect_responses'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:830:in `mail'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/mailers/helpers.rb:19:in `devise_mail'
# ./app/mailers/devise/mailer.rb:12:in `confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:23:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:22:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:609:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:608:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `tap'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:95:in `deliver_now'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:121:in `send_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:183:in `send_on_create_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:260:in `block in conditional'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `block in invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:132:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_commit_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:343:in `committed!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:86:in `commit_records'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `block in commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:168:in `commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `block in within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block in save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:307:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:42:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/persistence.rb:34:in `create'
# ./spec/mailers/user_mailer_messages_spec.rb:91:in `block (2 levels) in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:89:in `block in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:3:in `<top (required)>'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'









share|improve this question
























  • you should have some stacktrace pointing to the file an line that produces the error
    – arieljuod
    Nov 21 at 17:18










  • When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
    – Mohamed Sami
    Nov 21 at 17:20












  • @arieljuod do you know what could be the cause for this?
    – Mohamed Sami
    Nov 21 at 17:29






  • 1




    @MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
    – Tom Lord
    Nov 21 at 17:56








  • 1




    ...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
    – Tom Lord
    Nov 21 at 18:09















up vote
0
down vote

favorite












I got this error in rspec while I do not have any variable or method with that name, I even searched all over the project. This happens when I run Rspec for all the test cases, while individual test cases work fine.



I was upgrading the ruby on rails version from ruby 2.3.3 rails 4.1.6. and I upgraded the version one by one, and I have all test passed after reaching rails 5.1.6 with ruby 2.4.5 I got this error. while all the tests also worked normally with the same ruby version and rails 5.0.7



Please let me know if you have any idea how to solve this.



I rebuild the spec_helper.rb again using bin/rspec --init and I added the dependencies and I have a longer trace now



NameError:
undefined local variable or method `app' for #<Devise::Mailer:0x00007fd3271928f8>
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:30:in `build_rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:26:in `rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:41:in `build_rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:37:in `rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:45:in `current_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/helpers/controller_helper.rb:18:in `assign_controller'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/base.rb:211:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/action_dispatch/routing/url_for.rb:106:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `new'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `view_context'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:97:in `_render_template'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:83:in `render_to_body'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/rendering.rb:24:in `render'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:945:in `block in collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `map'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:927:in `collect_responses'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:830:in `mail'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/mailers/helpers.rb:19:in `devise_mail'
# ./app/mailers/devise/mailer.rb:12:in `confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:23:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:22:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:609:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:608:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `tap'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:95:in `deliver_now'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:121:in `send_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:183:in `send_on_create_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:260:in `block in conditional'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `block in invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:132:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_commit_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:343:in `committed!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:86:in `commit_records'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `block in commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:168:in `commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `block in within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block in save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:307:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:42:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/persistence.rb:34:in `create'
# ./spec/mailers/user_mailer_messages_spec.rb:91:in `block (2 levels) in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:89:in `block in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:3:in `<top (required)>'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'









share|improve this question
























  • you should have some stacktrace pointing to the file an line that produces the error
    – arieljuod
    Nov 21 at 17:18










  • When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
    – Mohamed Sami
    Nov 21 at 17:20












  • @arieljuod do you know what could be the cause for this?
    – Mohamed Sami
    Nov 21 at 17:29






  • 1




    @MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
    – Tom Lord
    Nov 21 at 17:56








  • 1




    ...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
    – Tom Lord
    Nov 21 at 18:09













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I got this error in rspec while I do not have any variable or method with that name, I even searched all over the project. This happens when I run Rspec for all the test cases, while individual test cases work fine.



I was upgrading the ruby on rails version from ruby 2.3.3 rails 4.1.6. and I upgraded the version one by one, and I have all test passed after reaching rails 5.1.6 with ruby 2.4.5 I got this error. while all the tests also worked normally with the same ruby version and rails 5.0.7



Please let me know if you have any idea how to solve this.



I rebuild the spec_helper.rb again using bin/rspec --init and I added the dependencies and I have a longer trace now



NameError:
undefined local variable or method `app' for #<Devise::Mailer:0x00007fd3271928f8>
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:30:in `build_rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:26:in `rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:41:in `build_rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:37:in `rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:45:in `current_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/helpers/controller_helper.rb:18:in `assign_controller'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/base.rb:211:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/action_dispatch/routing/url_for.rb:106:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `new'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `view_context'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:97:in `_render_template'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:83:in `render_to_body'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/rendering.rb:24:in `render'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:945:in `block in collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `map'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:927:in `collect_responses'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:830:in `mail'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/mailers/helpers.rb:19:in `devise_mail'
# ./app/mailers/devise/mailer.rb:12:in `confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:23:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:22:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:609:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:608:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `tap'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:95:in `deliver_now'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:121:in `send_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:183:in `send_on_create_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:260:in `block in conditional'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `block in invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:132:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_commit_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:343:in `committed!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:86:in `commit_records'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `block in commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:168:in `commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `block in within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block in save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:307:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:42:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/persistence.rb:34:in `create'
# ./spec/mailers/user_mailer_messages_spec.rb:91:in `block (2 levels) in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:89:in `block in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:3:in `<top (required)>'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'









share|improve this question















I got this error in rspec while I do not have any variable or method with that name, I even searched all over the project. This happens when I run Rspec for all the test cases, while individual test cases work fine.



I was upgrading the ruby on rails version from ruby 2.3.3 rails 4.1.6. and I upgraded the version one by one, and I have all test passed after reaching rails 5.1.6 with ruby 2.4.5 I got this error. while all the tests also worked normally with the same ruby version and rails 5.0.7



Please let me know if you have any idea how to solve this.



I rebuild the spec_helper.rb again using bin/rspec --init and I added the dependencies and I have a longer trace now



NameError:
undefined local variable or method `app' for #<Devise::Mailer:0x00007fd3271928f8>
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:30:in `build_rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:26:in `rack_mock_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:41:in `build_rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:37:in `rack_test_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/rack-test-1.1.0/lib/rack/test/methods.rb:45:in `current_session'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/helpers/controller_helper.rb:18:in `assign_controller'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/base.rb:211:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/action_dispatch/routing/url_for.rb:106:in `initialize'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `new'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:72:in `view_context'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:97:in `_render_template'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:83:in `render_to_body'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/rendering.rb:24:in `render'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:945:in `block in collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `map'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:942:in `collect_responses_from_templates'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:927:in `collect_responses'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:830:in `mail'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/mailers/helpers.rb:19:in `devise_mail'
# ./app/mailers/devise/mailer.rb:12:in `confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:186:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:97:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/callbacks.rb:19:in `process_action'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionpack-5.1.6/lib/abstract_controller/base.rb:124:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:23:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:15:in `handle_exceptions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/rescuable.rb:22:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionview-5.1.6/lib/action_view/rendering.rb:30:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:609:in `block in process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `block in instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/notifications.rb:166:in `instrument'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/base.rb:608:in `process'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:105:in `block in processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `tap'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:104:in `processed_mailer'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/actionmailer-5.1.6/lib/action_mailer/message_delivery.rb:95:in `deliver_now'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:121:in `send_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/devise-4.5.0/lib/devise/models/confirmable.rb:183:in `send_on_create_confirmation_instructions'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:413:in `block in make_lambda'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:260:in `block in conditional'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `block in invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `each'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:511:in `invoke_after'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:132:in `run_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/callbacks.rb:827:in `_run_commit_callbacks'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:343:in `committed!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:86:in `commit_records'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:178:in `block in commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:168:in `commit_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:207:in `block in within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:210:in `transaction'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:381:in `with_transaction_returning_status'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:308:in `block in save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:323:in `rollback_active_record_state!'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/transactions.rb:307:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/suppressor.rb:42:in `save'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activerecord-5.1.6/lib/active_record/persistence.rb:34:in `create'
# ./spec/mailers/user_mailer_messages_spec.rb:91:in `block (2 levels) in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:89:in `block in <top (required)>'
# ./spec/mailers/user_mailer_messages_spec.rb:3:in `<top (required)>'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `block in load'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/melsatar/.rvm/gems/ruby-2.4.5/gems/activesupport-5.1.6/lib/active_support/dependencies.rb:286:in `load'






ruby-on-rails ruby rspec ruby-on-rails-5 rspec-rails






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 at 20:42

























asked Nov 21 at 17:17









Mohamed Sami

184217




184217












  • you should have some stacktrace pointing to the file an line that produces the error
    – arieljuod
    Nov 21 at 17:18










  • When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
    – Mohamed Sami
    Nov 21 at 17:20












  • @arieljuod do you know what could be the cause for this?
    – Mohamed Sami
    Nov 21 at 17:29






  • 1




    @MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
    – Tom Lord
    Nov 21 at 17:56








  • 1




    ...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
    – Tom Lord
    Nov 21 at 18:09


















  • you should have some stacktrace pointing to the file an line that produces the error
    – arieljuod
    Nov 21 at 17:18










  • When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
    – Mohamed Sami
    Nov 21 at 17:20












  • @arieljuod do you know what could be the cause for this?
    – Mohamed Sami
    Nov 21 at 17:29






  • 1




    @MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
    – Tom Lord
    Nov 21 at 17:56








  • 1




    ...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
    – Tom Lord
    Nov 21 at 18:09
















you should have some stacktrace pointing to the file an line that produces the error
– arieljuod
Nov 21 at 17:18




you should have some stacktrace pointing to the file an line that produces the error
– arieljuod
Nov 21 at 17:18












When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
– Mohamed Sami
Nov 21 at 17:20






When I run individual spec for the test cases, it is successful, the main issue when I run all test cases together actually
– Mohamed Sami
Nov 21 at 17:20














@arieljuod do you know what could be the cause for this?
– Mohamed Sami
Nov 21 at 17:29




@arieljuod do you know what could be the cause for this?
– Mohamed Sami
Nov 21 at 17:29




1




1




@MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
– Tom Lord
Nov 21 at 17:56






@MohamedSami The error points to: app/mailers/devise/mailer.rb:12. What's in that file? What's on line 12? And the problem was originally triggered from spec/controllers/answers_controller_spec.rb:150. What is this test? What's on line 150?
– Tom Lord
Nov 21 at 17:56






1




1




...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
– Tom Lord
Nov 21 at 18:09




...So the question comes back, for the third time, to: Can you please provide a Minimal, Complete, and Verifiable example? It looks like you're doing something "wrong" in the tests, like trying to use rack-test without defining an app. But I don't know what's wrong, because you haven't shared any code.
– Tom Lord
Nov 21 at 18:09












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










It seems that the issue was one of the controllers' files, I was including a depreciated Rack::Test::Methods which made the conflict. If you experience a similar issue, remove it in rails 5.1



include Rack::Test::Methods





share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417425%2fnameerror-undefined-local-variable-or-method-app-for-rails-5-1-6-upgraded%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    It seems that the issue was one of the controllers' files, I was including a depreciated Rack::Test::Methods which made the conflict. If you experience a similar issue, remove it in rails 5.1



    include Rack::Test::Methods





    share|improve this answer

























      up vote
      0
      down vote



      accepted










      It seems that the issue was one of the controllers' files, I was including a depreciated Rack::Test::Methods which made the conflict. If you experience a similar issue, remove it in rails 5.1



      include Rack::Test::Methods





      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        It seems that the issue was one of the controllers' files, I was including a depreciated Rack::Test::Methods which made the conflict. If you experience a similar issue, remove it in rails 5.1



        include Rack::Test::Methods





        share|improve this answer












        It seems that the issue was one of the controllers' files, I was including a depreciated Rack::Test::Methods which made the conflict. If you experience a similar issue, remove it in rails 5.1



        include Rack::Test::Methods






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 23 at 23:16









        Mohamed Sami

        184217




        184217






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53417425%2fnameerror-undefined-local-variable-or-method-app-for-rails-5-1-6-upgraded%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Lallio

            Unable to find Lightning Node

            Futebolista