<commit_before>require 'spec_helper'

describe RasterizerController do
  good_response = {"top" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_top.png",
          "side" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_side.png",
          "front" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_front.png"}
  describe "When image is requested via GET" do
    it "should return a UrlGenerationError" do
      expect{get 'index'}.to raise_error(ActionController::UrlGenerationError)
    end
  end

  describe "when image is requested via POST" do
    describe "without any parameters" do
      it "should return 400" do
        post :create
        response.response_code.should eq(400)
      end
    end

    describe "with bad parameters" do
      it "should return 400" do
        json = {'dude' => 'this should not work', 'or' => 'this'}
        post :create, json
        response.response_code.should eq(400)
      end
    end

    describe "with broken links" do
      it "should return 400" do
        json = {'top' => 'kaboom', 'side' => 'bacon', 'front' => 'broken'}
        post :create, json
        response.response_code.should eq(424)
      end
    end

    describe "with proper parameters" do
      it "should respond with success" do
        post :create, good_response
        response.should be_success
      end
    end
  end
end<commit_msg>Added test for too big of a size<commit_after>require 'spec_helper'

describe RasterizerController do
  good_request = {"top" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_top.png",
          "side" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_side.png",
          "front" => "https://raw.github.com/HeisenBugDev/QuantumCraft/develop/src/main/resources/assets/quantumcraft/textures/blocks/machineIOF_front.png"}
  describe "When image is requested via GET" do
    it "should return a UrlGenerationError" do
      expect{get 'index'}.to raise_error(ActionController::UrlGenerationError)
    end
  end

  describe "when image is requested via POST" do
    describe "without any parameters" do
      it "should return 400" do
        post :create
        response.response_code.should eq(400)
      end
    end

    describe "with bad parameters" do
      it "should return 400" do
        json = {'dude' => 'this should not work', 'or' => 'this'}
        post :create, json
        response.response_code.should eq(400)
      end
    end

    describe "with broken links" do
      it "should return 400" do
        json = {'top' => 'kaboom', 'side' => 'bacon', 'front' => 'broken'}
        post :create, json
        response.response_code.should eq(424)
      end
    end

    describe "with proper parameters" do
      it "should respond with success" do
        post :create, good_request
        response.should be_success
      end
    end

    describe "with a size too big" do
      it "should return 400" do
        json = good_request.dup
        json[:s] = 1001
        post :create, json
        response.response_code.should eq(400)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.1031769163509181, 'fraction_numerical': 0.013407169921305742, 'mean_word_length': 2.8692220969560314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, 'https://': 6, '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': '666852', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1005, 'n_words': 277}