Files
growstuff/spec/features/crops/browse_crops_spec.rb
T
Brenda Wallace 977a984c24 Remove Elasticsearch integration and related code
- Deleted Elasticsearch gems from Gemfile and Gemfile.lock.
- Updated README and TECH documentation to reflect the removal of Elasticsearch.
- Removed Elasticsearch-related code from models, controllers, services, and factories.
- Adjusted tests to eliminate dependencies on Elasticsearch.
- Cleaned up Docker configuration and environment variables related to Elasticsearch.
- Added a TODO file for future gem reviews and potential removals.
2026-10-22 15:37:03 +13:00

58 lines
1.3 KiB
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe "browse crops" do
let!(:tomato) { create(:tomato) }
let!(:maize) { create(:maize) }
let!(:pending_crop) { create(:crop_request) }
let!(:rejected_crop) { create(:rejected_crop) }
shared_examples 'shows crops' do
before do
visit crops_path
end
it "shows a list of crops" do
expect(page).to have_content tomato.name
end
it "pending crops are not listed" do
expect(page).to have_no_content pending_crop.name
end
it "rejected crops are not listed" do
expect(page).to have_no_content rejected_crop.name
end
end
shared_examples 'add new crop' do
it "shows a new crop link" do
expect(page).to have_link "Add New Crop"
end
end
context 'anon' do
include_examples 'shows crops'
it { expect(page).to have_no_link "Add New Crop" }
end
context 'member' do
include_context 'signed in member'
include_examples 'shows crops'
include_examples 'add new crop'
end
context 'wrangler' do
include_context 'signed in crop wrangler'
include_examples 'shows crops'
include_examples 'add new crop'
end
context 'admin' do
include_context 'signed in admin'
include_examples 'shows crops'
include_examples 'add new crop'
end
end