undefined method `deliveries' for ActionMailer::Base:Class - ruby-on-rails

I started randomly getting the following stack trace in my project on this repo when running tests. My buddy forked and cloned and he doesn't get the error. I also have other projects that call the deliveries method and they have no problems. I have tried deleting the file and re cloning and it still doesn't work. I honestly have no idea where to start. Any help would be greatly appreciated.
Failure/Error: Unable to find matching line from backtrace
NoMethodError:
undefined method `deliveries' for ActionMailer::Base:Class
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/actionmailer-4.1.1/lib/action_mailer/base.rb:553:in `method_missing'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/actionmailer-4.1.1/lib/action_mailer/test_case.rb:59:in `initialize_test_deliveries'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.1/lib/rspec/rails/adapters.rb:109:in `block (2 levels) in setup'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:349:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:410:in `block in run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:410:in `each'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:410:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:485:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:340:in `run_before_example'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:147:in `block in run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:210:in `call'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-rails-3.0.1/lib/rspec/rails/adapters.rb:68:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:294:in `instance_exec'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:430:in `block (2 levels) in run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:210:in `call'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:432:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/hooks.rb:485:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:303:in `with_around_example_hooks'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example.rb:145:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:494:in `block in run_examples'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:490:in `map'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:490:in `run_examples'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:457:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:458:in `block in run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:458:in `map'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/example_group.rb:458:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:112:in `map'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/reporter.rb:54:in `report'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:108:in `run_specs'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:86:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:70:in `run'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/lib/rspec/core/runner.rb:38:in `invoke'
# /Users/Evan/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.2/exe/rspec:4:in `<top (required)>'
# /Users/Evan/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load'
# /Users/Evan/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>'
# /Users/Evan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
# /Users/Evan/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.

Apparently the problem was my gemset. I am not sure how it happened because it was seemingly in the middle of writing code in a test but I installed a new gemset and all is good. Thanks for anyone who took the time to read this and or edit my post.

Related

What could cause factory-bot to not properly associate uploaded file fields in Big Sur

Upon upgrading to Big Sur specs utilizing fixture_file_upload are not working.
My test model has file details such as
t.string "report_file_name"
t.string "report_content_type"
t.integer "report_file_size"
t.datetime "report_updated_at"
The skinny version of my factory:
FactoryBot.define do
factory :test do
report { fixture_file_upload "#{Rails.root}/spec/factories/paperclip/test_report.pdf", 'application/pdf' }
end
end
Stack Trace:
ActiveRecord::RecordInvalid:
Validation failed: Report content type is invalid, Report is invalid
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/configuration.rb:18:in `block in initialize'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluation.rb:18:in `create'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:12:in `block in result'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:9:in `tap'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:9:in `result'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory.rb:43:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:29:in `block in run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:28:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:5:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:33:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute/association.rb:19:in `block in to_proc'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `instance_exec'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `block in define_attribute'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:56:in `get'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `each'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `block in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `tap'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluation.rb:13:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:9:in `result'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory.rb:43:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:29:in `block in run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:28:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:5:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:33:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute/association.rb:19:in `block in to_proc'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `instance_exec'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `block in define_attribute'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:56:in `get'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `each'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `block in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `tap'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluation.rb:13:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:9:in `result'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory.rb:43:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:29:in `block in run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:28:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:5:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:33:in `association'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute/association.rb:19:in `block in to_proc'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `instance_exec'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluator.rb:77:in `block in define_attribute'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:56:in `get'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:16:in `block (2 levels) in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `each'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:15:in `block in object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `tap'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/attribute_assigner.rb:14:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/evaluation.rb:13:in `object'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy/create.rb:9:in `result'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory.rb:43:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:29:in `block in run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/factory_runner.rb:28:in `run'
# /Users/evanlepolt/.rvm/gems/ruby-2.5.3/gems/factory_bot-4.8.2/lib/factory_bot/strategy_syntax_method_registrar.rb:20:in `block in define_singular_strategy_method'
# ./spec/services/submissions/njb_soft_spec.rb:8:in `block (2 levels) in <top (required)>'
FactoryBot 4.8.2
Rails 5.2.2
Ruby 2.5.3
I have updated xcode, and updated/upgraded all of my homebrew pours.
The worst part about this is that I cannot reproduce the issue in a separate repository which makes me think that somewhere in our repo we're overwriting some factory_bot setting.
In Linux and Mohave this works fine, and if I remove the report from the factory and do it manually elsewhere in my spec then it works in Big Sur.
test = create(:test)
test.report = fixture_file_upload "#{Rails.root}/spec/factories/paperclip/test_report.pdf", 'application/pdf'
This was neither a paperclip issue, nor a factorybot issue. My example code is incorrect in that we are using a .tlf file, not a pdf. Our model then validates this: validates_attachment_content_type :report_layout, content_type: 'text/plain'
On Big Sur mac began reading this file as json, instead of plain text.
file -b --mime my_file.tlf
# macOS 11.1
application/json; charset=us-ascii
# macOS 10.15.6
text/plain; charset=us-ascii
# Ubuntu 18.04
text/plain; charset=us-ascii
So the content type validation failed. Answer was right in front of me the whole time

Should a Rails app load its .env file when its tests run?

Should my app be calling Dotenv.load when its running its test suite?
Without calling Dotenv.load while running my test suite, rspec fails with an error about missing an environment key. I have pasted the error and its stack trace below.
$ rspec
An error occurred while loading ./spec/requests/users/create_spec.rb.
Failure/Error: require File.expand_path('../../config/environment', __FILE__)
KeyError:
key not found: "REDIS_URL"
# (erb):11:in `fetch'
# (erb):11:in `<main>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application.rb:233:in `config_for'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable/engine.rb:31:in `block (2 levels) in <class:Engine>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `instance_eval'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:69:in `block in execute_hook'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:60:in `with_execution_control'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:65:in `execute_hook'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:50:in `block in run_load_hooks'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `each'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/lazy_load_hooks.rb:49:in `run_load_hooks'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable/server/base.rb:85:in `<module:Server>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable/server/base.rb:4:in `<module:ActionCable>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable/server/base.rb:3:in `<top (required)>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable.rb:44:in `server'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actioncable-5.1.4/lib/action_cable/engine.rb:46:in `block (3 levels) in <class:Engine>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:426:in `instance_exec'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:426:in `eval_block'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:443:in `block in clear!'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:443:in `each'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb:443:in `clear!'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:50:in `block in clear!'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:48:in `each'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:48:in `clear!'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:17:in `reload!'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:41:in `block in updater'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/activesupport-5.1.4/lib/active_support/file_update_checker.rb:81:in `execute'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:42:in `updater'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/routes_reloader.rb:31:in `execute_if_updated'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application/finisher.rb:128:in `block in <module:Finisher>'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `instance_exec'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/initializable.rb:30:in `run'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/initializable.rb:59:in `block in run_initializers'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/initializable.rb:58:in `run_initializers'
# /Users/robskrob/.rvm/gems/ruby-2.4.1/gems/railties-5.1.4/lib/rails/application.rb:353:in `initialize!'
# ./config/environment.rb:5:in `<top (required)>'
# ./spec/rails_helper.rb:4:in `require'
# ./spec/rails_helper.rb:4:in `<top (required)>'
# ./spec/requests/users/create_spec.rb:1:in `require'
# ./spec/requests/users/create_spec.rb:1:in `<top (required)>'
Outside of a Rails app you want to do the following:
require 'dotenv/tasks'
task start: [:dotenv] do
# this Rake tasks depends on the dotenv loading task
puts 'hi'
end
Inside a Rails app:
Since you're actually in a Rails app, I would make sure you're using dotenv-rails in your Gemfile, instead of just dotenv. The former will auto run the dotenv stuff as part of the Rails startup routine

Why are my view specs behaving inconsistently?

I'm getting some strange results from view specs
Failure/Error: assert_select "div.fileinput-new.thumbnail"
ArgumentError:
wrong number of arguments (3 for 1)
Ok, so this seems self explanatory (though I'm not sure what are the 3 arguments referenced).
However, if I run the suite again, I might get 0 errors. And the next, 5 errors, of the same type as above but referencing different DOM elements.
There is nothing fancy in any of these specs
describe do
build :object / create :object
#object = assign(:object, object )
it 'displays the DOM elements' do
render
asset_select #DOM_elements
end
end
What could cause this kind of inconsistent coverage of view specs?
An example stack trace
Failure/Error: assert_select "div.fileinput-new.thumbnail"
ArgumentError:
wrong number of arguments (3 for 1)
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/actionview-4.2.6/lib/action_view/helpers/text_helper.rb:52:in `concat'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/searchable.rb:165:in `evaluate'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/searchable.rb:165:in `block in xpath'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/searchable.rb:156:in `map'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/searchable.rb:156:in `xpath'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/searchable.rb:193:in `css_internal'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:76:in `block in css'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:187:in `block in each'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:186:in `upto'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:186:in `each'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:75:in `inject'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/nokogiri-1.6.7.2/lib/nokogiri/xml/node_set.rb:75:in `css'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions/html_selector.rb:20:in `select'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions.rb:174:in `assert_select'
# ./spec/views/users/settings/profile.html.erb_spec.rb:24:in `block (4 levels) in <top (required)>'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions.rb:295:in `nest_selection'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions.rb:177:in `block in assert_select'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions.rb:174:in `tap'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rails-dom-testing-1.0.7/lib/rails/dom/testing/assertions/selector_assertions.rb:174:in `assert_select'
# ./spec/views/users/settings/profile.html.erb_spec.rb:22:in `block (3 levels) in <top (required)>'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:236:in `instance_exec'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:236:in `block in run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:478:in `block in with_around_and_singleton_context_hooks'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:435:in `block in with_around_example_hooks'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:478:in `block in run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:618:in `block in run_around_example_hooks_for'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:320:in `call'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:320:in `call'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-rails-3.4.2/lib/rspec/rails/adapters.rb:127:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:425:in `instance_exec'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:425:in `instance_exec'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:389:in `execute_with'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:620:in `block (2 levels) in run_around_example_hooks_for'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:320:in `call'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:320:in `call'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:621:in `run_around_example_hooks_for'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/hooks.rb:478:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:435:in `with_around_example_hooks'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:478:in `with_around_and_singleton_context_hooks'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example.rb:233:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:581:in `block in run_examples'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:577:in `map'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:577:in `run_examples'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:543:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:544:in `block in run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:544:in `map'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/example_group.rb:544:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:119:in `block (3 levels) in run_specs'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:119:in `map'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:119:in `block (2 levels) in run_specs'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1680:in `with_suite_hooks'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:118:in `block in run_specs'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/reporter.rb:77:in `report'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:117:in `run_specs'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:93:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:78:in `run'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/lib/rspec/core/runner.rb:45:in `invoke'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/gems/rspec-core-3.4.4/exe/rspec:4:in `<top (required)>'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/bin/rspec:23:in `load'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/bin/rspec:23:in `<main>'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/bin/ruby_executable_hooks:15:in `eval'
# /Users/me/.rvm/gems/ruby-2.2.3#myapp/bin/ruby_executable_hooks:15:in `<main>'
This is not a definitive answer: it appears that, for some weird reason, the evaluate method in the Nokogiri's Searchable module considers the concat() function as a custom XPath function instead of the internal XPath function.
External XPath functions are called as normal ruby methods in the context of the handler attribute of evaluate. Normally the handler is the SubstitutionContext class but in your case it seems that sometimes this gets the context of the TextHelper module where the concat method is defined, accepting just 1 parameter (whereas the XPath's concat() function accepts any number of parameters). I think that this can lead to the errors you observe.
Could you open the searchable.rb file (see the stack trace for its location) on this line and add before it some debug messages to inspect the contents of the following variables?
puts "ctx #{ctx.inspect}"
puts "path #{path.inspect}"
puts "handler #{handler.inspect}"
if handler.respond_to?(:concat)
puts "concat #{handler.method(:concat).inspect}"
else
puts "not responding to :concat"
end
Then, can you provide the output printed for one of the failing tests?
Update: the output showed that indeed the tests context was being polluted by the ActionView::TextHelpers module and in the end it turned out that there was a ActionView::Helpers module included in a model used in the tests.

undefined method `unbind' for Proc (but I don't have unbind method)

Have a basic helper test:
require 'rails_helper'
describe BuilderHelper do
...
describe 'press events classes' do
let(:account) { create(:candidate_profile).account }
before { allow_any_instance_of(Object).to receive(:current_account).and_return account }
specify do
expect_any_instance_of(PublicPage).to receive(:show_press?).and_return true
expect_any_instance_of(PublicPage).to receive(:show_events?).and_return true
expect(press_events_classes(account)).to eq 'section'
end
...
end
...
end
And it gives strange error:
Failure/Error: before { allow_any_instance_of(Object).to receive(:current_account).and_return account }
NoMethodError:
undefined method `unbind' for #<Proc:0x00000009803640>
# ./spec/helpers/builder_helper_spec.rb:27:in `block (3 levels) in <top (required)>'
# ./spec/support/vcr.rb:16:in `block (2 levels) in <top (required)>'
(that's it, that's the whole error log)
So the error is in before block.
The problem is that I don't have an "unbind" method anywhere.
I looked in Rails repo - it doesn't seem to have anything too.
Don't know what's the problem. Can anyone help where to look?
Update
Alright, thanks to comment I got this:
1) BuilderHelper press events classes
Failure/Error: before { allow_any_instance_of(Object).to receive(:current_account).and_return account }
NoMethodError:
undefined method `unbind' for #<Proc:0x000000025ff9e0>
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/proxy.rb:372:in `original_unbound_method_handle_from_ancestor_for'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/proxy.rb:355:in `original_method_handle_for'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/method_double.rb:28:in `original_method'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/method_double.rb:57:in `define_proxy_method'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/method_double.rb:50:in `configure_method'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/method_double.rb:150:in `add_stub'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/proxy.rb:112:in `add_stub'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/any_instance/proxy.rb:38:in `block in stub'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/any_instance/proxy.rb:81:in `map'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/any_instance/proxy.rb:81:in `perform_proxying'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/any_instance/proxy.rb:37:in `stub'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/matchers/receive.rb:88:in `setup_method_substitute'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/matchers/receive.rb:81:in `setup_any_instance_method_substitute'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/matchers/receive.rb:49:in `setup_any_instance_allowance'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/targets.rb:45:in `define_matcher'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-mocks-3.0.4/lib/rspec/mocks/targets.rb:14:in `block in delegate_to'
# ./spec/helpers/builder_helper_spec.rb:27:in `block (3 levels) in <top (required)>'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:349:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:410:in `block in run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:410:in `each'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:410:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:485:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:340:in `run_before_example'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:147:in `block in run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `call'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-rails-3.0.2/lib/rspec/rails/adapters.rb:72:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:430:in `block (2 levels) in run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `call'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# ./spec/support/vcr.rb:16:in `block (2 levels) in <top (required)>'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:294:in `instance_exec'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:430:in `block (2 levels) in run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `call'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:210:in `block (2 levels) in <class:Procsy>'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:432:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/hooks.rb:485:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:303:in `with_around_example_hooks'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example.rb:145:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:494:in `block in run_examples'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:490:in `map'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:490:in `run_examples'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:457:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:458:in `block in run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:458:in `map'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/example_group.rb:458:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:112:in `block (2 levels) in run_specs'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:112:in `map'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:112:in `block in run_specs'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/reporter.rb:54:in `report'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:108:in `run_specs'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:86:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:70:in `run'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/lib/rspec/core/runner.rb:38:in `invoke'
# /home/dell/.rvm/gems/ruby-2.1.5/gems/rspec-core-3.0.4/exe/rspec:4:in `<top (required)>'
# /home/dell/.rvm/gems/ruby-2.1.5/bin/rspec:23:in `load'
# /home/dell/.rvm/gems/ruby-2.1.5/bin/rspec:23:in `<main>'
# /home/dell/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
# /home/dell/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
Still not sure what to do.
Update
Solved by replacing this:
before { allow_any_instance_of(Object).to receive(:current_account).and_return account }
With this:
before { allow_any_instance_of(BuilderHelper).to receive(:current_account).and_return account }
So my best guess which is hard to tell base on this but what I had happen was I in fact stubbed out the find and returned a proc object in its place.
let(:record) { create :record } # This is a Proc
allow(Object).to receive(:find).and_return(record)
allow_any_instance_of(Object).to receive(:update) # This calls unbind
Sadly trying to figure out where the first stub happened. But I bet it is there in your code.

Why do I get an "ActiveRecord::ConnectionNotEstablished" error when trying to run my rspec 2.99 tests with Rails 4.1?

I have a Rails app that I'm upgrading to Rails 4.1.4. I also have an RSpec test suite that I want to run against the app with the updated Rails version. The application does not use a database, just communicates with services. However, when I try to run the tests, I get this error:
Failure/Error: Unable to find matching line from backtrace
ActiveRecord::ConnectionNotEstablished:
ActiveRecord::ConnectionNotEstablished
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:541:in `retrieve_connection'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/connection_handling.rb:87:in `connection'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:499:in `create_fixtures'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:984:in `load_fixtures'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:957:in `setup_fixtures'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/activerecord-4.1.4/lib/active_record/fixtures.rb:806:in `before_setup'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-rails-2.99.0/lib/rspec/rails/adapters.rb:68:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_exec'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/extensions/instance_eval_with_args.rb:16:in `instance_eval_with_args'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:241:in `instance_eval_with_args'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:106:in `block (2 levels) in run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:104:in `call'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:104:in `run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/hooks.rb:446:in `run_hook'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:462:in `run_around_each_hooks'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:250:in `with_around_each_hooks'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example.rb:113:in `run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:514:in `block in run_examples'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:510:in `map'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:510:in `run_examples'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/example_group.rb:495:in `run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `block (2 levels) in run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `map'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:24:in `block in run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/reporter.rb:58:in `report'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/command_line.rb:21:in `run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:103:in `run'
# /Users/karianneberg/.rvm/gems/ruby-1.9.3-p484/gems/rspec-core-2.99.1/lib/rspec/core/runner.rb:17:in `block in autorun'
I don't understand why it's trying to fire up active record
The application runs just fine when I don't run it though tests, and the tests run just fine on Rails 4.0. I'm still using RSpec-rails 2.99. Does anyone know what the problem might be?

Resources