test didn’t pass yet: how to fix deprecation warning

By User

Initially I had code that had DEPRECATION WARNINGS:

Ruby on Rails: Deprecation Warnings

I’ve changed this code follow some suggestions.
thanks

But I still has one warning.
See the warning and code as below.
How to fix it and got green test?

thanks.

DEPRECATION WARNING: Using positional arguments in integration tests has been deprecated, ETA: 00:00:30
in favor of keyword arguments, and will be removed in Rails 5.1.

Deprecated style:
get “/profile”, { id: 1 }, { “X-Extra-Header” => “123” }

New keyword style:
get “/profile”, params: { id: 1 }, headers: { “X-Extra-Header” => “123” }
(called from block (2 levels) in at /home/ubuntu/workspace/origin/test/integration/following_test.rb:30)
68/68: [=========================================================] 100% Time: 00:00:04, Time: 00:00:04

Finished in 4.25284s
68 tests, 336 assertions, 0 failures, 0 errors, 0 skips

require 'test_helper'
class FollowingTest < ActionDispatch::IntegrationTest
  def setup
    @user  = users(:michael)
    @other = users(:archer)
    log_in_as(@user)
  end
  test "following page" do
    get following_user_path(@user)
    assert_not @user.following.empty?
    assert_match @user.following.count.to_s, response.body
    @user.following.each do |user|
      assert_select "a[href=?]", user_path(user)
    end
  end
  test "followers page" do
    get followers_user_path(@user)
    assert_not @user.followers.empty?
    assert_match @user.followers.count.to_s, response.body
    @user.followers.each do |user|
      assert_select "a[href=?]", user_path(user)
    end
  end
test "should follow a user the standard way" do
    assert_difference '@user.following.count', 1 do
      post relationships_path, followed_id: @other.id
    end
  end
  test "should follow a user with Ajax" do
    assert_difference '@user.following.count', 1 do
      post relationships_path(followed_id: @other.id), xhr: true
    end
  end
  test "should unfollow a user the standard way" do
    @user.follow(@other)
    relationship = @user.active_relationships.find_by(followed_id: @other.id)
    assert_difference '@user.following.count', -1 do
      delete relationship_path(relationship)
    end
  end
  test "should unfollow a user with Ajax" do
    @user.follow(@other)
    relationship = @user.active_relationships.find_by(followed_id: @other.id)
    assert_difference '@user.following.count', -1 do
      delete relationship_path(relationship), xhr: true
    end
  end
end

Source: Stack Overflow

    

Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273