<commit_before>require 'rails_helper'

feature 'Official positions' do

  context "Badge" do

    background do
      @user1 = create(:user, official_level: 1, official_position: "Employee", official_position_badge: true)
      @user2 = create(:user, official_level: 0, official_position: "")
    end

    scenario "Comments" do
      proposal = create(:proposal)
      comment1 = create(:comment, commentable: proposal, user: @user1)
      comment2 = create(:comment, commentable: proposal, user: @user2)

      visit proposal_path(proposal)

      expect_badge_for("comment", comment1)
      expect_no_badge_for("comment", comment2)
    end

    context "Debates" do

      background do
        @debate1 = create(:debate, author: @user1)
        @debate2 = create(:debate, author: @user2)
      end

      scenario "Index" do
        visit debates_path

        expect_badge_for("debate", @debate1)
        expect_no_badge_for("debate", @debate2)
      end

      scenario "Show" do
        visit debate_path(@debate1)
        expect_badge_for("debate", @debate1)

        visit debate_path(@debate2)
        expect_no_badge_for("debate", @debate2)
      end

    end

    context "Proposals" do

      background do
        @proposal1 = create(:proposal, author: @user1)
        @proposal2 = create(:proposal, author: @user2)

        featured_proposals = 3.times { create(:proposal) }
      end

      scenario "Index" do
        visit proposals_path
        debugger

        expect_badge_for("proposal", @proposal1)
        expect_no_badge_for("proposal", @proposal2)
      end

      scenario "Show" do
        visit proposal_path(@proposal1)
        expect_badge_for("proposal", @proposal1)

        visit proposal_path(@proposal2)
        expect_no_badge_for("proposal", @proposal2)
      end

    end

    context "Spending proposals" do

      background do
        @spending_proposal1 = create(:spending_proposal, author: @user1)
        @spending_proposal2 = create(:spending_proposal, author: @user2)
      end

      scenario "Index" do
        visit spending_proposals_path

        expect_badge_for("spending_proposal", @spending_proposal1)
        expect_no_badge_for("spending_proposal", @spending_proposal2)
      end

      scenario "Show" do
        visit spending_proposal_path(@spending_proposal1)
        expect_badge_for("spending_proposal", @spending_proposal1)

        visit spending_proposal_path(@spending_proposal2)
        expect_no_badge_for("spending_proposal", @spending_proposal2)
      end

    end
  end
end<commit_msg>Fixes typo<commit_after>require 'rails_helper'

feature 'Official positions' do

  context "Badge" do

    background do
      @user1 = create(:user, official_level: 1, official_position: "Employee", official_position_badge: true)
      @user2 = create(:user, official_level: 0, official_position: "")
    end

    scenario "Comments" do
      proposal = create(:proposal)
      comment1 = create(:comment, commentable: proposal, user: @user1)
      comment2 = create(:comment, commentable: proposal, user: @user2)

      visit proposal_path(proposal)

      expect_badge_for("comment", comment1)
      expect_no_badge_for("comment", comment2)
    end

    context "Debates" do

      background do
        @debate1 = create(:debate, author: @user1)
        @debate2 = create(:debate, author: @user2)
      end

      scenario "Index" do
        visit debates_path

        expect_badge_for("debate", @debate1)
        expect_no_badge_for("debate", @debate2)
      end

      scenario "Show" do
        visit debate_path(@debate1)
        expect_badge_for("debate", @debate1)

        visit debate_path(@debate2)
        expect_no_badge_for("debate", @debate2)
      end

    end

    context "Proposals" do

      background do
        @proposal1 = create(:proposal, author: @user1)
        @proposal2 = create(:proposal, author: @user2)

        featured_proposals = 3.times { create(:proposal) }
      end

      scenario "Index" do
        visit proposals_path

        expect_badge_for("proposal", @proposal1)
        expect_no_badge_for("proposal", @proposal2)
      end

      scenario "Show" do
        visit proposal_path(@proposal1)
        expect_badge_for("proposal", @proposal1)

        visit proposal_path(@proposal2)
        expect_no_badge_for("proposal", @proposal2)
      end

    end

    context "Spending proposals" do

      background do
        @spending_proposal1 = create(:spending_proposal, author: @user1)
        @spending_proposal2 = create(:spending_proposal, author: @user2)
      end

      scenario "Index" do
        visit spending_proposals_path

        expect_badge_for("spending_proposal", @spending_proposal1)
        expect_no_badge_for("spending_proposal", @spending_proposal2)
      end

      scenario "Show" do
        visit spending_proposal_path(@spending_proposal1)
        expect_badge_for("spending_proposal", @spending_proposal1)

        visit spending_proposal_path(@spending_proposal2)
        expect_no_badge_for("spending_proposal", @spending_proposal2)
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.09101608473911338, 'fraction_numerical': 0.016084739113377794, 'mean_word_length': 2.9929522317932653, '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': '4427809', 'n_tokens_mistral': 1684, 'n_tokens_neox': 1601, 'n_words': 333}