Files
growstuff/spec/requests/seeds_controller_update_spec.rb
T
Brenda Wallace 062bf738b3 Hide the packet text for now, and fix the packet_text migration
The text read from a packet is kept in seeds.packet_text but is not on any form
or page yet: the OCR script will fill it in a follow-up. The column's migration
comment had an apostrophe that broke its string, so it did not run.
2026-10-28 20:35:09 +13:00

28 lines
879 B
Ruby

# frozen_string_literal: true
require 'rails_helper'
# What a packet says, saved with the seed from its edit dialog.
describe SeedsController, '#update' do
include Devise::Test::IntegrationHelpers
let(:seed) { create(:seed) }
let(:details) do
{ variety: 'Island Bay Italian', batch_number: 'LYIG0403', row_spacing: '50' }
end
before do
sign_in seed.owner
patch seed_path(seed), params: { seed: details }
seed.reload
end
it('saves the variety') { expect(seed.variety).to eq 'Island Bay Italian' }
it('saves the batch number') { expect(seed.batch_number).to eq 'LYIG0403' }
it('saves the row spacing') { expect(seed.row_spacing).to eq 50 }
it('does not take the text from the packet from a member') do
patch seed_path(seed), params: { seed: { packet_text: 'typed by a member' } }
expect(seed.reload.packet_text).to be_nil
end
end