Anyone have any tips for testing this thing? If you test the ProductsDatatable class on it's own (rather than testing the results of the products/index controller action) how can you instantiate a view_context on initialization? Or is it best to just rely on mocking/stubbing everything that would normally exist in the context of a normal request?
Looking back to the Presenters from Scratch screencast looks like it might be something like this?
ruby
classProductDatatableTest < ActionView::TestCase
test "something or other"do
datatable = ProductDatatable.new(view)
# but, how to set the params for the view?endend
This is the first time I've ever seen "caching" implemented by storing something in Thread.current...is this somewhat of a standard practice? Anyone have any links to more explanation of this technique?
Anyone have any tips for testing this thing? If you test the ProductsDatatable class on it's own (rather than testing the results of the products/index controller action) how can you instantiate a
view_context
on initialization? Or is it best to just rely on mocking/stubbing everything that would normally exist in the context of a normal request?Looking back to the Presenters from Scratch screencast looks like it might be something like this?
Any tips on daemonizing this thing?
This is the first time I've ever seen "caching" implemented by storing something in Thread.current...is this somewhat of a standard practice? Anyone have any links to more explanation of this technique?