A proof of concept netzke component with a testcase that breaks pagination under postgresql (at the time of writing), due to the behavior of limit by ... offset ...
under postgres
The basic test case is:
- An app with one model,
Author(id, name, created_at, updated_at)
- One
Netzke::Basepack::Grid
,Authors
, ofAuthor
records, sorted by thename
column by default - A test that generates a bunch of
Author
instances, all with the samename
(so postgres can sort however it wants), loads theAuthors
grid and compares the entries in the grid with the entries generated. On my machine, this usually results in a few missed entries.
Running
$ bundle exec rspec
can give results along the lines of
F
Failures:
1) Authors should not show the same record on two different pages
Failure/Error: run_mocha_spec 'authors'
RuntimeError:
Failures:
1) should not show the same record on two different pages
Error: Error: expected [ 4,
95,
152,
196,
215,
372,
411,
569,
597,
610,
616,
723,
788,
855,
910 ] to sort of equal [] (http://127.0.0.1:42643/assets/netzke/testing/expect/expect.js:99)
# ./spec/features/authors_spec.rb:11:in `block (2 levels) in <top (required)>'
Finished in 38.39 seconds (files took 2.36 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/features/authors_spec.rb:10 # Authors should not show the same record on two different pages
demonstrating the issue, but can
spec/features/author_spec.rb
, andspec/features/javascripts/authors.js.coffee
(the rest is just boilerplate for Rails, included for the sake of reproducibility)
You'll need to set up PostgreSQL in config/database.yml
.
Like for any netzke project:
- public/extjs should link to ExtJS (I used 5.1.1 GPL)
- public/images/icons should link to the famfam silk icons