spec/integration/projects_spec.rb in patch_ruby-1.0.0.pre vs spec/integration/projects_spec.rb in patch_ruby-1.0.0

- old
+ new

@@ -1,31 +1,24 @@ -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 + Patch.configure do |config| + config.access_token = ENV['PATCH_RUBY_API_KEY'] + end - # START receive_projects - page_limit = 1 - next_page = 1 - projects = [] + it 'supports retrieve and list' do + 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 + 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 + 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 + retrieve_project_response = Patch::Project.retrieve_project(project_id) + expect(retrieve_project_response.data.id).to eq project_id end end