<NME> global_hooks.rb
<BEF> require 'yt/config'
require 'yt/models/account'

module Helpers
  def test_account
    @test_account ||= Yt::Account.new(refresh_token: ENV['YT_TEST_REFRESH_TOKEN'])
  end
end

RSpec.configure do |config|
  config.include Helpers

  config.before :each do
    allow(Yt).to receive(:configuration).and_return(Yt::Configuration.new)
    allow(Yt.configuration).to receive(:api_key).and_return(nil)
  end

  config.before :each, device_app: true do
    allow(Yt.configuration).to receive(:client_id).and_return(ENV['YT_TEST_CLIENT_ID'])
    allow(Yt.configuration).to receive(:client_secret).and_return(ENV['YT_TEST_CLIENT_SECRET'])
  end

  config.before :each, server_app: true do
    allow(Yt.configuration).to receive(:api_key).and_return(ENV['YT_TEST_API_KEY'])
  end
end
      config.api_key = ENV['YT_TEST_SERVER_API_KEY']
    end
  end
end

<MSG> Merge branch 'analytics'

<DFF> @@ -30,4 +30,17 @@ RSpec.configure do |config|
       config.api_key = ENV['YT_TEST_SERVER_API_KEY']
     end
   end
-end
+
+  config.before :all, partner: true do
+    Yt.configure do |config|
+      config.client_id = ENV['YT_TEST_PARTNER_CLIENT_ID']
+      config.client_secret = ENV['YT_TEST_PARTNER_CLIENT_SECRET']
+    end
+    # Create one Youtube Partner channel, authenticated as the content owner
+    attrs = {refresh_token: ENV['YT_TEST_CONTENT_OWNER_REFRESH_TOKEN']}
+    attrs[:owner_name] = ENV['YT_TEST_CONTENT_OWNER_NAME']
+    content_owner = Yt::Account.new attrs
+    attrs = {id: ENV['YT_TEST_PARTNER_CHANNEL_ID'], auth: content_owner}
+    $partner_channel = Yt::Channel.new attrs
+  end
+end
\ No newline at end of file

{'addition_count': 14, 'commit_subject': "Merge branch 'analytics'", 'deletion_count': 1, 'file_extension': '.rb', 'lang': 'rb', 'license': 'mit', 'repo_name': 'Fullscreen/yt'}