Rails 5.1 testing changed attributes Deprecation Warning
rspec, ruby-on-rails, ruby-on-rails-5, unit-testing
Solution
Try upgrading Carrierwave as suggested here: https://github.com/lebedev-yury/carrierwave-base64/issues/53
Problem
I just upgraded my 5.0.1 app to 5.1 and I'm getting a huge amount of warnings whenever I run my rspec tests. ``` DEPRECATION WARNING: ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2. (called from <top (required)> at /home/doomy/Documents/rsm/config/initializers/new_framework_defaults.rb:23) ...DEPRECATION WARNING: The behavior of `changed_attributes` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.transform_values(&:first)` instead. (called from block (3 levels) in <top (required)> at /home/doomy/Documents/rsm/spec/controllers/products_spec.rb:48) DEPRECATION WARNING: The behavior of `changes` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes` instead. (called from block (3 levels) in <top (required)> at /home/doomy/Documents/rsm/spec/controllers/products_spec.rb:48) DEPRECATION WARNING: The behavior of `changed` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_changes.keys` instead. (called from block (3 levels) in <top (required)> at /home/doomy/Documents/rsm/spec/controllers/products_spec.rb:48) DEPRECATION WARNING: The behavior of `attribute_change` inside of after callbacks will be changing in the next version of Rails. The new return value will reflect the behavior of calling the method after `save` returned (e.g. the opposite of what it returns now). To maintain the current behavior, use `saved_change_to_attribute` instead. (called from block (3 levels) in <top (required)> at /home/doomy/Documents/rsm/spec/controllers/products_spec.rb:48) ``` This goes on for every test I have and ends up taking a significant while longer since it's writing so much stuff to console. I'm rather confused as to what I should be changing as the offending code doesn't look anything out of the ordinary. Here's products_spec.rb around line 48 ``` describe "GET show" do before(:each) do @product = create(:product, user: create(:product_admin)) end context "anonymously" do it "renders" do get :show, params: { id: @product.id } expect(response).to render_template("show") end end context "as regular user" do it "renders" do get :show, params: { id: @product.id } login(create(:user)) expect(response).to render_template("show") end end ... ``` I assume it has to do something with the before filter, but I can't quite figure out what. Searching for the warning returns nothing useful. Thanks.