mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-06-02 13:16:35 -04:00
* Ruby 3.2/Bundler 2.4 * Fix creation * Upgrade to js-routes 2. Put all js routes into a global namespace. * Remove js-routes * Remove * Adjust ownership * Appease codeclimate for the nth time * Fix deprecation warning by explicitly calling to_fs * Fix deprecation warning by explicitly calling to_fs * Fix deprecation warning by explicitly calling to_fs * Swap to will paginate successor for bootstrap * Update app/views/members/show.html.haml * Update app/views/plantings/index.rss.haml * Update .env * Update .devcontainer/.env * Fix spec * Update spec * Fix spec * Pin to 2.4.22 * 3 space indent * Regenerate * Update rubocop * Rubocop * More rubocop * Regenerate * Fix Capybara/NegationMatcher
59 lines
1.4 KiB
Ruby
59 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
describe "browse crops", :search do
|
|
let!(:tomato) { FactoryBot.create(:tomato, :reindex) }
|
|
let!(:maize) { FactoryBot.create(:maize, :reindex) }
|
|
let!(:pending_crop) { FactoryBot.create(:crop_request, :reindex) }
|
|
let!(:rejected_crop) { FactoryBot.create(:rejected_crop, :reindex) }
|
|
|
|
shared_examples 'shows crops' do
|
|
before do
|
|
Crop.reindex
|
|
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
|