require 'test_helper'

class ItemsControllerTest < ActionDispatch::IntegrationTest
  # test "the truth" do
  #   assert true
  # end

  def setup
    @base_title = "RailsOnlineShop"
  end

  test "should get new item form page" do
    get new_item_url
    assert_response :success
    assert_select "title", "#{@base_title}"
  end
end

require 'test_helper'

class ItemsControllerTest < ActionDispatch::IntegrationTest
  # test "the truth" do
  #   assert true
  # end

  test "should get new item form page" do
    get new_item_url
    assert_response :success
    assert_select "title", "RailsOnlineShop"
  end
end

--- 
+++ 
@@ -5,9 +5,13 @@
   #   assert true
   # end
 
+  def setup
+    @base_title = "RailsOnlineShop"
+  end
+
   test "should get new item form page" do
     get new_item_url
     assert_response :success
-    assert_select "title", "RailsOnlineShop"
+    assert_select "title", "#{@base_title}"
   end
 end
Create special function "setup" to have ability to use instance variables throughout tests.  This runs before running any of the tests, helps to refactor if certain things will be used multiple times
