<commit_before>require 'rails_helper'

describe "new photo page" do
  let(:photo) { FactoryBot.create :photo }

  context "signed in member" do
    let(:member) { FactoryBot.create :member }

    before { login_as member }

    context "viewing a planting" do
      let(:planting) { FactoryBot.create :planting, owner: member }

      it "add photo" do
        visit planting_path(planting)
        within '.planting-actions' do
          click_link('Add photo')
        end
        expect(page).to have_text planting.crop.name
      end
    end

    context "viewing a harvest" do
      let(:harvest) { FactoryBot.create :harvest, owner: member }

      it "add photo" do
        visit harvest_path(harvest)
        within '.harvest-actions' do
          click_link "Add photo"
        end
        expect(page).to have_text harvest.crop.name
      end
    end

    context "viewing a garden" do
      let(:garden) { FactoryBot.create :garden, owner: member }

      it "add photo" do
        visit garden_path(garden)
        within '.garden-actions' do
          click_link "Add photo"
        end
        expect(page).to have_text garden.name
      end
    end

    describe "viewing a seed" do
      let(:seed) { FactoryBot.create :seed, owner: member }

      it "add photo" do
        visit seed_path(seed)
        click_link 'Actions'
        first('.seed-actions').click_link('Add photo')
        expect(page).to have_text seed.to_s
      end
    end
  end
end<commit_msg>click actions in menu when capybara test is adding photos<commit_after>require 'rails_helper'

describe "new photo page" do
  let(:photo) { FactoryBot.create :photo }

  context "signed in member" do
    let(:member) { FactoryBot.create :member }

    before { login_as member }

    context "viewing a planting" do
      let(:planting) { FactoryBot.create :planting, owner: member }

      it "add photo" do
        visit planting_path(planting)
        click_link 'Actions'
        within '.planting-actions' do
          click_link('Add photo')
        end
        expect(page).to have_text planting.crop.name
      end
    end

    context "viewing a harvest" do
      let(:harvest) { FactoryBot.create :harvest, owner: member }

      it "add photo" do
        visit harvest_path(harvest)
        click_link 'Actions'
        within '.harvest-actions' do
          click_link "Add photo"
        end
        expect(page).to have_text harvest.crop.name
      end
    end

    context "viewing a garden" do
      let(:garden) { FactoryBot.create :garden, owner: member }

      it "add photo" do
        visit garden_path(garden)
        click_link 'Actions'
        within '.garden-actions' do
          click_link "Add photo"
        end
        expect(page).to have_text garden.name
      end
    end

    describe "viewing a seed" do
      let(:seed) { FactoryBot.create :seed, owner: member }

      it "add photo" do
        visit seed_path(seed)
        click_link 'Actions'
        first('.seed-actions').click_link('Add photo')
        expect(page).to have_text seed.to_s
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08993853121967, 'fraction_numerical': 0.0, 'mean_word_length': 2.2478991596638656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2257201', 'n_tokens_mistral': 938, 'n_tokens_neox': 907, 'n_words': 276}