<commit_before>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

require 'spec_helper'

describe Diaspora::Camo do
  before do
    AppConfig.privacy.camo.root = 'http://localhost:3000/camo/'
    AppConfig.privacy.camo.key = 'kittenpower'

    @raw_image_url = 'http://example.com/kitten.jpg'
    @camo_image_url = "#{AppConfig.privacy.camo.root}5bc5b9d7ebd202841ab0667c4fc8d4304278f902/687474703a2f2f6578616d706c652e636f6d2f6b697474656e2e6a7067"
  end

  describe '#image_url' do
    it 'should not rewrite local URLs' do
      local_image = "#{AppConfig.environment.url}kitten.jpg"
      expect(Diaspora::Camo::image_url(local_image)).to eq(local_image)
    end

    it 'should not rewrite relative URLs' do
      relative_image = "/kitten.jpg"
      expect(Diaspora::Camo::image_url(relative_image)).to eq(relative_image)
    end

    it 'should not rewrite already camo-fied URLs' do
      camo_image = "#{AppConfig.privacy.camo.root}1234/56789abcd"
      expect(Diaspora::Camo::image_url(camo_image)).to eq(camo_image)
    end<commit_msg>A little bit of cleanup<commit_after>#   Copyright (c) 2010, Diaspora Inc.  This file is
#   licensed under the Affero General Public License version 3 or later.  See
#   the COPYRIGHT file.

require 'spec_helper'

describe Diaspora::Camo do
  before do
    AppConfig.privacy.camo.root = 'http://localhost:3000/camo/'
    AppConfig.privacy.camo.key = 'kittenpower'

    @raw_image_url = 'http://example.com/kitten.jpg'
    @camo_image_url = AppConfig.privacy.camo.root + '5bc5b9d7ebd202841ab0667c4fc8d4304278f902/687474703a2f2f6578616d706c652e636f6d2f6b697474656e2e6a7067'
  end

  describe '#image_url' do
    it 'should not rewrite local URLs' do
      local_image = AppConfig.environment.url + 'kitten.jpg'
      expect(Diaspora::Camo::image_url(local_image)).to eq(local_image)
    end

    it 'should not rewrite relative URLs' do
      relative_image = '/kitten.jpg'
      expect(Diaspora::Camo::image_url(relative_image)).to eq(relative_image)
    end

    it 'should not rewrite already camo-fied URLs' do
      camo_image = AppConfig.privacy.camo.root + '1234/56789abcd'
      expect(Diaspora::Camo::image_url(camo_image)).to eq(camo_image)
    end
{'fraction_non_alphanumeric': 0.1032986111111111, 'fraction_numerical': 0.07725694444444445, 'mean_word_length': 4.133630289532294, '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': '6694692', 'n_tokens_mistral': 964, 'n_tokens_neox': 835, 'n_words': 166}