Files
growstuff/spec/features/crops/delete_crop_spec.rb
2026-04-23 13:31:16 +00:00

38 lines
945 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
describe "Delete crop spec" do
shared_examples 'delete crop' do
let!(:pending_crop) { create(:crop_request) }
let!(:approved_crop) { create(:crop) }
it "deletes approved crop" do
visit crop_path(approved_crop)
click_link 'Actions'
accept_confirm do
click_link 'Delete'
end
expect(page).to have_content "crop was successfully destroyed"
end
it "deletes pending crop" do
visit crop_path(pending_crop)
click_link 'Actions'
accept_confirm do
click_link 'Delete'
end
expect(page).to have_content "crop was successfully destroyed"
end
end
context "As a crop wrangler" do
include_context 'signed in crop wrangler'
it_behaves_like 'delete crop'
end
context 'admin' do
include_context 'signed in admin'
it_behaves_like 'delete crop'
end
end