Commit 62f113fe authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'followup-leakyconst-master-check' into 'master'

Move NoPrimaryClass table def to last spec

Closes #218730

See merge request gitlab-org/gitlab!33015
parents 31a0f48d 13c59342
---
title: Move NoPrimary table def to last context in spec
merge_request: 33015
author: Rajendra Kadam
type: other
...@@ -9,14 +9,6 @@ describe Gitlab::Graphql::Pagination::Keyset::Connection do ...@@ -9,14 +9,6 @@ describe Gitlab::Graphql::Pagination::Keyset::Connection do
let(:schema) { GraphQL::Schema.define(query: query_type, mutation: nil)} let(:schema) { GraphQL::Schema.define(query: query_type, mutation: nil)}
let(:context) { GraphQL::Query::Context.new(query: OpenStruct.new(schema: schema), values: nil, object: nil) } let(:context) { GraphQL::Query::Context.new(query: OpenStruct.new(schema: schema), values: nil, object: nil) }
before do
stub_const('NoPrimaryKey', Class.new(ActiveRecord::Base))
NoPrimaryKey.class_eval do
self.table_name = 'no_primary_key'
self.primary_key = nil
end
end
subject(:connection) do subject(:connection) do
described_class.new(nodes, { context: context, max_page_size: 3 }.merge(arguments)) described_class.new(nodes, { context: context, max_page_size: 3 }.merge(arguments))
end end
...@@ -303,6 +295,14 @@ describe Gitlab::Graphql::Pagination::Keyset::Connection do ...@@ -303,6 +295,14 @@ describe Gitlab::Graphql::Pagination::Keyset::Connection do
end end
context 'when there is no primary key' do context 'when there is no primary key' do
before do
stub_const('NoPrimaryKey', Class.new(ActiveRecord::Base))
NoPrimaryKey.class_eval do
self.table_name = 'no_primary_key'
self.primary_key = nil
end
end
let(:nodes) { NoPrimaryKey.all } let(:nodes) { NoPrimaryKey.all }
it 'raises an error' do it 'raises an error' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment