Sha256: 8a11a92e1258d4e421455d543c21f6a846ecd39662b3365c824740575d040092

Contents?: true

Size: 971 Bytes

Versions: 1

Compression:

Stored size: 971 Bytes

Contents

require 'spec_helper'

RSpec.describe 'Projects Integration' do
  it "supports retrieve and list" do
    VCR.use_cassette('projects') do
      # Configure the Patch gem
      Patch.configure do |config|
        config.access_token = ENV['PATCH_RUBY_API_KEY']
        config.host = ENV['PATCH_RUBY_HOST']
      end

      # START receive_projects
      page_limit = 1
      next_page = 1
      projects = []

      while !next_page.nil? && next_page <= page_limit
        retrieve_projects_response = Patch::Project.retrieve_projects(page: next_page)
        next_page = retrieve_projects_response.meta.next_page
        projects += retrieve_projects_response.data
      end

      expect(projects.length).not_to be_zero
      project_id = retrieve_projects_response.data.first.id
      # END receive_projects

      retrieve_project_response = Patch::Project.retrieve_project(project_id)
      expect(retrieve_project_response.data.id).to eq project_id
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
patch_ruby-1.0.0.pre spec/integration/projects_spec.rb