File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change 44
55ActiveRecord ::Base . establish_connection (
66 adapter : :nulldb ,
7- schema : 'support/active_record/schema'
7+ schema : 'spec/ support/active_record/schema.rb '
88)
99
10+ NullDB . configure { |ndb | def ndb . project_root ; Dir . pwd ; end ; }
11+
1012shared_examples 'produces_correct_sql' do
1113 it 'produces correct sql for first page' do
1214 paginated_sql = ApiPagination . paginate ( collection , per_page : per_page )
3537 end
3638 end
3739
38- context 'reification' do
39- before do
40- allow ( collection ) . to receive ( :table_name ) . and_return ( 'aaBB_CC_DD' )
40+ context 'reflections' do
41+ it 'invokes the correct methods to determine type' do
42+ expect ( collection ) . to receive ( :klass ) . at_least ( :once )
43+ . and_call_original
44+ ApiPagination . paginate ( collection )
4145 end
4246
43- it 'correctly produces the correct model independent of table name' do
44- expect { ApiPagination . paginate ( collection ) } . not_to raise_error
47+ it 'does not fail if table name is not snake cased class name' do
48+ allow ( collection ) . to receive ( :table_name ) . and_return ( SecureRandom . uuid )
49+ expect { ApiPagination . paginate ( collection ) } . to_not raise_error
4550 end
4651 end
4752end
You can’t perform that action at this time.
0 commit comments