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 4
4
5
5
ActiveRecord ::Base . establish_connection (
6
6
adapter : :nulldb ,
7
- schema : 'support/active_record/schema'
7
+ schema : 'spec/ support/active_record/schema.rb '
8
8
)
9
9
10
+ NullDB . configure { |ndb | def ndb . project_root ; Dir . pwd ; end ; }
11
+
10
12
shared_examples 'produces_correct_sql' do
11
13
it 'produces correct sql for first page' do
12
14
paginated_sql = ApiPagination . paginate ( collection , per_page : per_page )
35
37
end
36
38
end
37
39
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 )
41
45
end
42
46
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
45
50
end
46
51
end
47
52
end
You can’t perform that action at this time.
0 commit comments