Files
growstuff/spec/controllers/seeds_controller_spec.rb
Daniel O'Connor 6e7cf1c813 Refactor Seeds to remove Elasticsearch dependency (#4684)
* Refactor Seeds to remove Elasticsearch dependency

This commit refactors the `SeedsController` and `Seed` model to remove
dependency on Elasticsearch and Searchkick.

Key changes:
- Removed `SearchSeeds` concern from the `Seed` model.
- Reimplemented `Seed.homepage_records` using ActiveRecord.
- Refactored `SeedsController#index` to use ActiveRecord for filtering,
  eager loading, and pagination.
- Deleted `app/models/concerns/search_seeds.rb`.
- Updated relevant specs to remove Searchkick-specific tags and setup.

Co-authored-by: CloCkWeRX <365751+CloCkWeRX@users.noreply.github.com>

* Remove Seed.reindex

* Remove trait

* Fix tests

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2026-06-24 21:54:43 +09:30

34 lines
692 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe SeedsController do
let(:owner) { create(:member) }
describe "GET index" do
describe "picks up owner from params" do
before do
get :index, params: { member_slug: owner.slug }
end
it { expect(assigns(:owner)).to eq(owner) }
end
end
describe 'GET new' do
before { sign_in owner }
it { expect(response).to be_successful }
context 'with parent planting' do
let!(:planting) { create(:planting, owner:) }
before do
get :new, params: { planting_slug: planting.to_param }
end
it { expect(assigns(:planting)).to eq(planting) }
end
end
end