<commit_before>require 'spec_helper'

include UploadHelper


describe 'correct routing to profile', :type => :feature do
  it 'will load the profile at the correct path' do
    user = create(:user)
    visit "/profile/#{ user.username }"
    page.status_code.should be 200
  end
end

describe 'user profile header', :type => :feature do
  before(:each) do
    @user = create(:user)
    login_as(@user, :scope => :user)

    4.times { |i| upload_test_file }
    2.times { |i| upload_test_another_file }

    logout(:user)

    visit "/profile/#{ @user.username }"
  end

  it "shows the user's name" do
    expect(page).to have_content @user.username
  end

  it 'shows their join date' do
    expect(page).to have_content(
      "Joined #{ @user.created_at.strftime('%Y-%m-%d') }"
    )
  end

  context 'when logged in' do
    it 'shows how many images you have' do
      login_as(@user, :scope => :user)
      expect(page).to have_content '6 images'
    end
  end

  context 'when logged out' do
    it 'shows how many public images you have' do
    end
  end

  after(:each) do
    logout(:user)
    Warden.test_reset!
  end
end

describe 'image gallery', :type => :feature do
  context 'when logged in' do
    it 'shows all the images you uploaded' do
      user = create(:user)
      login_as(user, :scope => :user)
      upload_test_file
      upload_test_another_file

      visit "/profile/#{ user.username }"
      gallery_links = page.all(:css, '#recent_uploads .small-tile a')
      recently_upload_images = page.all(:css, '#recent_uploads .small-tile img')

      srcs  = recently_upload_images.map { |image| image[:src] }
      hrefs = gallery_links.map { |link| link[:href] }

      expected_srcs  = Image.all.map { |image| image.file.url(:thumb) }
      expected_hrefs = Image.all.map do |image|
        Rails.application.routes.url_helpers.image_path(image)
      end

      srcs.should    =~ expected_srcs
      expected_hrefs =~ expected_hrefs
    end
  end

  context 'when logged out' do
    it 'shows only your public images' do
    end
  end
end

describe 'album gallery' do
  context 'when logged in' do
    it 'shows all the albums you created' do
    end
  end

  context 'when logged out' do
    it 'shows only the public albums you created' do
    end
  end
end<commit_msg>Update description<commit_after>require 'spec_helper'

include UploadHelper


describe 'correct routing to profile', :type => :feature do
  it 'will load the profile at the correct path' do
    user = create(:user)
    visit "/profile/#{ user.username }"
    page.status_code.should be 200
  end
end

describe 'user profile header', :type => :feature do
  before(:each) do
    @user = create(:user)
    login_as(@user, :scope => :user)

    4.times { |i| upload_test_file }
    2.times { |i| upload_test_another_file }

    logout(:user)

    visit "/profile/#{ @user.username }"
  end

  it "shows the user's name" do
    expect(page).to have_content @user.username
  end

  it 'shows their join date' do
    expect(page).to have_content(
      "Joined #{ @user.created_at.strftime('%Y-%m-%d') }"
    )
  end

  context 'when logged in' do
    it 'shows how many images you have' do
      login_as(@user, :scope => :user)
      expect(page).to have_content '6 images'
    end
  end

  context 'when logged out' do
    it 'shows how many public images you have' do
    end
  end

  after(:each) do
    logout(:user)
    Warden.test_reset!
  end
end

describe 'image gallery', :type => :feature do
  context 'when logged in' do
    it 'shows images you uploaded' do
      user = create(:user)
      login_as(user, :scope => :user)
      upload_test_file
      upload_test_another_file

      visit "/profile/#{ user.username }"
      gallery_links = page.all(:css, '#recent_uploads .small-tile a')
      recently_upload_images = page.all(:css, '#recent_uploads .small-tile img')

      srcs  = recently_upload_images.map { |image| image[:src] }
      hrefs = gallery_links.map { |link| link[:href] }

      expected_srcs  = Image.all.map { |image| image.file.url(:thumb) }
      expected_hrefs = Image.all.map do |image|
        Rails.application.routes.url_helpers.image_path(image)
      end

      srcs.should    =~ expected_srcs
      expected_hrefs =~ expected_hrefs
    end
  end

  context 'when logged out' do
    it 'shows only your public images' do
    end
  end
end

describe 'album gallery' do
  context 'when logged in' do
    it 'shows all the albums you created' do
    end
  end

  context 'when logged out' do
    it 'shows only the public albums you created' do
    end
  end
end
{'fraction_non_alphanumeric': 0.1070263215140309, 'fraction_numerical': 0.0026103980857080703, 'mean_word_length': 2.883445945945946, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6596285', 'n_tokens_mistral': 1548, 'n_tokens_neox': 1489, 'n_words': 470}