<commit_before>require "rails_helper"

RSpec.describe UsersController, type: :controller do
  describe "GET #show" do
    context "when user exists" do
      it "returns http success" do
        user = FactoryBot.create(:user)
        get :show, params: { username: user.username }
        expect(response).to have_http_status(:success)
      end
    end

    context "when user does not exists" do
      it "throws ActiveRecord::RecordNotFound" do
        expect do
          get :show, params: { username: "invalid" }
        end.to raise_exception(ActiveRecord::RecordNotFound)
      end
    end
  end
end
<commit_msg>Increate coverage of UsersController<commit_after>require "rails_helper"

RSpec.describe UsersController, type: :controller do
  describe "GET #show" do
    context "when user exists" do
      let(:user) { FactoryBot.create(:user) }

      it "returns http success" do
        get :show, params: { username: user.username }
        expect(response).to be_successful
      end
    end

    context "when user does not exists" do
      it "throws ActiveRecord::RecordNotFound" do
        expect do
          get :show, params: { username: "invalid" }
        end.to raise_exception(ActiveRecord::RecordNotFound)
      end
    end
  end

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

    before(:each) do
      sign_in user
    end

    describe "PATCH #update" do
      context "with valid user attributes" do
        let(:user_attributes) { FactoryBot.attributes_for(:user) }

        it "returns http redirect to #show" do
          patch :update, params: { username: user.username, user: user_attributes }
          expect(response).to redirect_to(user)
        end
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08685714285714285, 'fraction_numerical': 0.0, 'mean_word_length': 2.7019027484143763, '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': '1548381', 'n_tokens_mistral': 496, 'n_tokens_neox': 485, 'n_words': 160}