<commit_before># # require_relative '../../spec_helper'
# # For Ruby < 1.9.3, use this instead of require_relative
require (File.expand_path('./../../../spec_helper', __FILE__))
require 'subexec'

class Uploader  < CarrierWave::Uploader::Base
  include CarrierWave::ImageSorcery
end

describe CarrierWave::ImageSorcery do

  before do
    @klass = Class.new do
      include CarrierWave::ImageSorcery
    end
    @instance = Uploader.new
    FileUtils.cp(file_path('landscape.jpg'), file_path('landscape_copy.jpg'))
    @instance.stub(:current_path).and_return(file_path('landscape_copy.jpg'))
    @instance.stub(:cached?).and_return true
  end

  after do
    FileUtils.rm([file_path('landscape_copy.jpg'), file_path('landscape_copy.png')], :force => true)
  end

  describe "#convert" do
    it "should convert from one format to another" do
      @instance.convert('png')
      img = Sorcery.new file_path('landscape_copy.png')
      img.identify.should =~ /PNG/
    end
  end

  describe '#resize_to_fill' do
    it "should resize the image to exactly the given dimensions" do
      @instance.resize_to_fill(200, 200)
      @instance.dimensions.should == check_dimension(200, 200)
    end

    it "should scale up the image if it smaller than the given dimensions" do
      @instance.resize_to_fill(1000, 1000)
      @instance.dimensions.should == check_dimension(1000, 1000)
    end
  end

  describe '#resize_and_pad' do
    it "should resize the image to exactly the given dimensions" do
      @instance.resize_and_pad(200, 200)
      @instance.dimensions.should == check_dimension(200, 200)
    end
<commit_msg>Fix #convert spec which is then failing<commit_after># # require_relative '../../spec_helper'
# # For Ruby < 1.9.3, use this instead of require_relative
require (File.expand_path('./../../../spec_helper', __FILE__))
require 'subexec'

class Uploader  < CarrierWave::Uploader::Base
  include CarrierWave::ImageSorcery
end

describe CarrierWave::ImageSorcery do

  before do
    @klass = Class.new do
      include CarrierWave::ImageSorcery
    end
    @instance = Uploader.new
    FileUtils.cp(file_path('landscape.jpg'), file_path('landscape_copy.jpg'))
    @instance.stub(:current_path).and_return(file_path('landscape_copy.jpg'))
    @instance.stub(:cached?).and_return true
  end

  after do
    FileUtils.rm([file_path('landscape_copy.jpg'), file_path('landscape_copy.png')], :force => true)
  end

  describe "#convert" do
    it "should convert from one format to another" do
      @instance.convert('png')
      img = Sorcery.new @instance.current_path
      img.identify.should =~ /PNG/
    end
  end

  describe '#resize_to_fill' do
    it "should resize the image to exactly the given dimensions" do
      @instance.resize_to_fill(200, 200)
      @instance.dimensions.should == check_dimension(200, 200)
    end

    it "should scale up the image if it smaller than the given dimensions" do
      @instance.resize_to_fill(1000, 1000)
      @instance.dimensions.should == check_dimension(1000, 1000)
    end
  end

  describe '#resize_and_pad' do
    it "should resize the image to exactly the given dimensions" do
      @instance.resize_and_pad(200, 200)
      @instance.dimensions.should == check_dimension(200, 200)
    end

{'fraction_non_alphanumeric': 0.11367127496159754, 'fraction_numerical': 0.02642089093701997, 'mean_word_length': 3.7394468704512374, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '4623470', 'n_tokens_mistral': 1109, 'n_tokens_neox': 1012, 'n_words': 264}