<commit_before>require 'spec_helper'

describe 'Application' do
  describe 'GET /' do
    it 'returns editor page' do
      get '/'
      last_response.should be_ok
      last_response.body.should include "editor_output"
      last_response.body.should include "editor_output"
    end
  end

  describe 'POST /render' do
    let(:render_url) { '/render' }

    context 'with no content' do
      it 'renders empty page' do
        post render_url

        expect(last_response).to be_ok
        expect(last_response.body).to be_empty
      end
    end

    context 'with invalid markup' do
      it 'renders error message' do
        post render_url, :content => "Hello World", :markup => "invalidmarkup"
        
        expect(last_response).not_to be_ok
        expect(last_response.body).to match /invalid markup/i
      end
    end

    context 'with valid params' do
      it 'renders generated content' do
        %w(markdown textile rdoc).each do |m|
          post render_url, :content => "Hello world", :markup => m
          
          expect(last_response).to be_ok
          expect(last_response.body).to match /Hello world/<commit_msg>More test tweaks<commit_after>require 'spec_helper'

describe 'Application' do
  describe 'GET /' do
    it 'renders editor page' do
      get '/'
      
      expect(last_response).to be_ok
      expect(last_response.body).to include "editor_output"
      expect(last_response.body).to include "editor_output"
    end
  end

  describe 'POST /render' do
    let(:render_url) { '/render' }

    context 'with no content' do
      it 'renders empty page' do
        post render_url

        expect(last_response).to be_ok
        expect(last_response.body).to be_empty
      end
    end

    context 'with invalid markup' do
      it 'renders error message' do
        post render_url, :content => "Hello World", :markup => "invalidmarkup"
        
        expect(last_response).not_to be_ok
        expect(last_response.body).to match /invalid markup/i
      end
    end

    context 'with valid params' do
      it 'renders generated content' do
        %w(markdown textile rdoc).each do |m|
          post render_url, :content => "Hello world", :markup => m
          
          expect(last_response).to be_ok
          expect(last_response.body).to match /Hello world/
{'fraction_non_alphanumeric': 0.08879310344827586, 'fraction_numerical': 0.0, 'mean_word_length': 2.413235294117647, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1407857', 'n_tokens_mistral': 697, 'n_tokens_neox': 676, 'n_words': 203}