# frozen_string_literal: true

require 'rails_helper'

describe "crops/_popover" do
  before do
    @tomato = create(:tomato)
    @sn = create(:solanum_lycopersicum, crop: @tomato)
    @planting = create(:planting, crop: @tomato)
    @tomato.reload # to pick up latest plantings_count
    render partial: 'crops/popover', locals: { crop: @tomato }
  end

  it 'has a scientific name' do
    expect(rendered).to have_content 'Solanum lycopersicum'
  end

  it 'shows count of plantings' do
    expect(rendered).to have_content '1 time'
  end
end
