Sha256: 690d27c612bafe0179ab7d267e5360cd4f78ec8335064dc28f39e41a6b1b9552

Contents?: true

Size: 1.24 KB

Versions: 11

Compression:

Stored size: 1.24 KB

Contents

RSpec.describe 'Preferences Integration' do
  it 'supports create, delete, retrieve and list' do
    retrieve_projects_response = Patch::Project.retrieve_projects
    expect(retrieve_projects_response.data.length).not_to be_zero
    project_id = retrieve_projects_response.data.first.id

    begin
      create_preference_response = Patch::Preference.create_preference(project_id: project_id)
      preference_id = create_preference_response.data.id
    rescue Patch::ApiError => e
      preference_id = Patch::Preference.retrieve_preferences().data.first.id
    end

    retrieve_preference_response = Patch::Preference.retrieve_preference(preference_id)
    expect(retrieve_preference_response.data.id).to eq preference_id

    page_limit = 1
    next_page = 1
    preferences = []

    while !next_page.nil? && next_page <= page_limit
      retrieve_preferences_response = Patch::Preference.retrieve_preferences(page: next_page)
      next_page = retrieve_preferences_response.meta.next_page
      preferences += retrieve_preferences_response.data
    end

    expect(preferences.length).not_to be_zero

    delete_preference_response = Patch::Preference.delete_preference(preference_id)
    expect(delete_preference_response.data.id).to eq preference_id
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
patch_ruby-1.15.2 spec/integration/preferences_spec.rb
patch_ruby-1.15.1 spec/integration/preferences_spec.rb
patch_ruby-1.15.0 spec/integration/preferences_spec.rb
patch_ruby-1.14.0 spec/integration/preferences_spec.rb
patch_ruby-1.13.0 spec/integration/preferences_spec.rb
patch_ruby-1.12.0 spec/integration/preferences_spec.rb
patch_ruby-1.11.1 spec/integration/preferences_spec.rb
patch_ruby-1.11.0 spec/integration/preferences_spec.rb
patch_ruby-1.10.2 spec/integration/preferences_spec.rb
patch_ruby-1.10.1 spec/integration/preferences_spec.rb
patch_ruby-1.10.0 spec/integration/preferences_spec.rb