brandoncordell
Joined 5/29/2017
brandoncordell said over 7 years ago on DataTables :

Would it make sense to memoize the User.count call? I'm not super familiar with memoization, so I'm not sure whether it would benefit this specific situation.


brandoncordell said over 3 years ago on Testing View Components :
I'm running into an issue with view components. I generated a component called `LikeButtonComponent`. The default generated test won't run. Here's the test as it sits:

# frozen_string_literal: true

require 'test_helper'

class LikeButtonComponentTest < ViewComponent::TestCase
  def test_component_renders_something_useful
    assert_equal(
      %(<span>Hello, components!</span>),
      render_inline(LikeButtonComponent.new(message: "Hello, components!")).css("span").to_html
    )
  end
end

This gives a `NameError: uninitialized constant LikeButtonComponentTest::LikeButtonComponent`.

Any ideas? I'm on Rails 6.1.4, Ruby 3.0.1, and view_components 2.37.0.