<commit_before>RSpec.describe ProtipsHelper, type: :helper do
  describe ".protip_search_results_to_render" do
    it 'has no protips to render' do
      expect(helper.protip_search_results_to_render(nil)).to be_nil
    end
  end
end<commit_msg>added spec for #users_background_image<commit_after>RSpec.describe ProtipsHelper, type: :helper do
  describe ".protip_search_results_to_render" do
    it 'has no protips to render' do
      expect(helper.protip_search_results_to_render(nil)).to be_nil
    end
  end

  describe '#users_background_image' do
    context 'user is logged in' do
      it 'returns #location_image_url_for @user' do
        assign(:user, 'test_user')
        allow(helper).to receive(:location_image_url_for).with('test_user').and_return('image_path')
        expect(helper.users_background_image).to eq 'image_path'
      end
    end

    context 'user is not logged in' do
      it 'returns nil' do
        assign(:user, nil)
        expect(helper.users_background_image).to be_nil
      end
    end

    context 'protip is set' do
      it 'returns #location_image_url_for @protip.user if @protip is not new_record' do
        @protip = double('protip', 'user' => 'test_user', 'new_record?' => false)
        allow(helper).to receive(:location_image_url_for).with('test_user').and_return('image_path')
        expect(helper.users_background_image).to eq 'image_path'
      end

      it 'returns nil if @protip is new_record' do
        @protip = double('protip', 'user' => 'test_user', 'new_record?' => true)
        expect(helper.users_background_image).to be_nil
      end
    end

    context 'protip is not set' do
      it 'returns nil' do
        assign(:protip, nil)
        expect(helper.users_background_image).to be_nil
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.09686450167973125, 'fraction_numerical': 0.0, 'mean_word_length': 3.36919315403423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2997508', 'n_tokens_mistral': 572, 'n_tokens_neox': 562, 'n_words': 144}