diff options
Diffstat (limited to 'spec/support/shared_examples/requests/api')
6 files changed, 16 insertions, 16 deletions
diff --git a/spec/support/shared_examples/requests/api/discussions_shared_examples.rb b/spec/support/shared_examples/requests/api/discussions_shared_examples.rb index 939ea405724..6315c10b0c4 100644 --- a/spec/support/shared_examples/requests/api/discussions_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/discussions_shared_examples.rb @@ -66,7 +66,7 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name, end it "returns a 404 error when noteable id not found" do - get api("/#{parent_type}/#{parent.id}/#{noteable_type}/12345/discussions", user) + get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{non_existing_record_iid}/discussions", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -90,7 +90,7 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name, end it "returns a 404 error if discussion not found" do - get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions/12345", user) + get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -248,7 +248,7 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name, it 'returns a 404 error when note id not found' do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}/notes/12345", user), + "discussions/#{note.discussion_id}/notes/#{non_existing_record_id}", user), params: { body: 'Hello!' } expect(response).to have_gitlab_http_status(:not_found) @@ -276,7 +276,7 @@ RSpec.shared_examples 'discussions API' do |parent_type, noteable_type, id_name, it 'returns a 404 error when note id not found' do delete api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}/notes/12345", user) + "discussions/#{note.discussion_id}/notes/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end diff --git a/spec/support/shared_examples/requests/api/issuable_participants_examples.rb b/spec/support/shared_examples/requests/api/issuable_participants_examples.rb index e442b988349..673d7741017 100644 --- a/spec/support/shared_examples/requests/api/issuable_participants_examples.rb +++ b/spec/support/shared_examples/requests/api/issuable_participants_examples.rb @@ -18,7 +18,7 @@ RSpec.shared_examples 'issuable participants endpoint' do end it 'returns a 404 when iid does not exist' do - get api("/projects/#{project.id}/#{area}/999/participants", user) + get api("/projects/#{project.id}/#{area}/#{non_existing_record_iid}/participants", user) expect(response).to have_gitlab_http_status(:not_found) end diff --git a/spec/support/shared_examples/requests/api/milestones_shared_examples.rb b/spec/support/shared_examples/requests/api/milestones_shared_examples.rb index 3afb26bc869..77b49b7caef 100644 --- a/spec/support/shared_examples/requests/api/milestones_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/milestones_shared_examples.rb @@ -56,7 +56,7 @@ RSpec.shared_examples 'group and project milestones' do |route_definition| end it 'does not return any milestone if none found' do - get api(route, user), params: { iids: [Milestone.maximum(:iid).succ] } + get api(route, user), params: { iids: [non_existing_record_iid] } expect(response).to have_gitlab_http_status(:ok) expect(json_response).to be_an Array @@ -120,7 +120,7 @@ RSpec.shared_examples 'group and project milestones' do |route_definition| end it 'returns a 404 error if milestone id not found' do - get api("#{route}/1234", user) + get api("#{route}/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -183,7 +183,7 @@ RSpec.shared_examples 'group and project milestones' do |route_definition| end it 'returns a 404 error if milestone id not found' do - put api("#{route}/1234", user), params: { title: 'updated title' } + put api("#{route}/#{non_existing_record_id}", user), params: { title: 'updated title' } expect(response).to have_gitlab_http_status(:not_found) end @@ -367,7 +367,7 @@ RSpec.shared_examples 'group and project milestones' do |route_definition| end it 'returns a 404 error if milestone id not found' do - not_found_route = "#{route}/1234/merge_requests" + not_found_route = "#{route}/#{non_existing_record_id}/merge_requests" get api(not_found_route, user) diff --git a/spec/support/shared_examples/requests/api/notes_shared_examples.rb b/spec/support/shared_examples/requests/api/notes_shared_examples.rb index 61ac9acb154..60ed61269df 100644 --- a/spec/support/shared_examples/requests/api/notes_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/notes_shared_examples.rb @@ -97,7 +97,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name| end it "returns a 404 error when noteable id not found" do - get api("/#{parent_type}/#{parent.id}/#{noteable_type}/12345/notes", user) + get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{non_existing_record_id}/notes", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -120,7 +120,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name| end it "returns a 404 error if note not found" do - get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/12345", user) + get api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -274,7 +274,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name| end it 'returns a 404 error when note id not found' do - put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/12345", user), + put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/#{non_existing_record_id}", user), params: { body: 'Hello!' } expect(response).to have_gitlab_http_status(:not_found) @@ -301,7 +301,7 @@ RSpec.shared_examples 'noteable API' do |parent_type, noteable_type, id_name| end it 'returns a 404 error when note id not found' do - delete api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/12345", user) + delete api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/notes/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end diff --git a/spec/support/shared_examples/requests/api/resolvable_discussions_shared_examples.rb b/spec/support/shared_examples/requests/api/resolvable_discussions_shared_examples.rb index 8d2a3f13d8e..5748e873fd4 100644 --- a/spec/support/shared_examples/requests/api/resolvable_discussions_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/resolvable_discussions_shared_examples.rb @@ -66,7 +66,7 @@ RSpec.shared_examples 'resolvable discussions API' do |parent_type, noteable_typ it 'returns a 404 error when note id not found' do put api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/"\ - "discussions/#{note.discussion_id}/notes/12345", user), + "discussions/#{note.discussion_id}/notes/#{non_existing_record_id}", user), params: { body: 'Hello!' } expect(response).to have_gitlab_http_status(:not_found) diff --git a/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb b/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb index 520c3ea8e47..f49f944f38d 100644 --- a/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb +++ b/spec/support/shared_examples/requests/api/resource_label_events_api_shared_examples.rb @@ -15,7 +15,7 @@ RSpec.shared_examples 'resource_label_events API' do |parent_type, eventable_typ end it "returns a 404 error when eventable id not found" do - get api("/#{parent_type}/#{parent.id}/#{eventable_type}/12345/resource_label_events", user) + get api("/#{parent_type}/#{parent.id}/#{eventable_type}/#{non_existing_record_id}/resource_label_events", user) expect(response).to have_gitlab_http_status(:not_found) end @@ -74,7 +74,7 @@ RSpec.shared_examples 'resource_label_events API' do |parent_type, eventable_typ end it "returns a 404 error if resource label event not found" do - get api("/#{parent_type}/#{parent.id}/#{eventable_type}/#{eventable[id_name]}/resource_label_events/12345", user) + get api("/#{parent_type}/#{parent.id}/#{eventable_type}/#{eventable[id_name]}/resource_label_events/#{non_existing_record_id}", user) expect(response).to have_gitlab_http_status(:not_found) end |