RailsCasts Pro episodes are now free!

Learn more or hide this

Rob Cameron's Profile

GitHub User: cannikin

Site: http://ridingtheclutch.com

Comments by Rob Cameron

Avatar

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
class ProductDatatableTest < ActionView::TestCase
  test "something or other" do
    datatable = ProductDatatable.new(view)
    # but, how to set the params for the view?
  end
end
Avatar

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?