rbexy icon indicating copy to clipboard operation
rbexy copied to clipboard

Rails spec helpers

Open patbenatar opened this issue 4 years ago • 0 comments

Currently using rspec-rails controller specs with anonymous controllers in order to get a view context. eg:

# Make this a controller spec for easy access to an ActionView context
RSpec.describe AtomicComponent::Base, type: :controller do
  controller(ActionController::Base) {}
  let(:view_context) { controller.view_context }

  # ...
end

Would be nice to get this context more easily. Maybe we add a type: :component for rspec?

Also a helper to add to context. Currently doing:

before { view_context.rbexy_context.last[:form] = double(...) }

patbenatar avatar Oct 25 '20 15:10 patbenatar