spec/integration/preferences_spec.rb in patch_ruby-1.2.5 vs spec/integration/preferences_spec.rb in patch_ruby-1.3.0
- old
+ new
@@ -8,11 +8,15 @@
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
- create_preference_response = Patch::Preference.create_preference(project_id: project_id)
- preference_id = create_preference_response.data.id
+ begin
+ create_preference_response = Patch::Preference.create_preference(project_id: project_id)
+ preference_id = create_preference_response.data.id
+ rescue => Patch::ApiError
+ 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