<commit_before>require 'rails_helper'

RSpec.describe PostsController, type: :controller do
  let(:admin) { create(:admin) }
  let(:post1) { create(:post) }
  let(:category1) { create(:category) }

  before(:each) do
    authenticate_member(admin)
  end

  it 'should get index' do
    get :index
    expect(response).to have_http_status(200)
  end

  describe 'posts aka conversations with pagination' do
    context 'when specifying last page' do
      it 'should return short page of results' do
        create_list(:post, 4)
        get :index, params: { page: 2, per_page: 3 }
        expect(assigns(:posts).length).to be < 3
        expect(response).to have_http_status(200)
      end
    end
    context 'without specifying page' do
      it 'should return one page of results' do
        create_list(:post, 16)
        get :index
        expect(assigns(:posts).length).to eq(10)
        expect(response).to have_http_status(200)
      end
    end<commit_msg>Add page out of range test<commit_after>require 'rails_helper'

RSpec.describe PostsController, type: :controller do
  let(:admin) { create(:admin) }
  let(:post1) { create(:post) }
  let(:category1) { create(:category) }

  before(:each) do
    authenticate_member(admin)
  end

  it 'should get index' do
    get :index
    expect(response).to have_http_status(200)
  end

  describe 'posts aka conversations with pagination' do
    context 'when specifying last page' do
      it 'should return short page of results' do
        create_list(:post, 4)
        get :index, params: { page: 2, per_page: 3 }
        expect(assigns(:posts).length).to be < 3
        expect(response).to have_http_status(200)
      end
    end
    context 'without specifying page' do
      it 'should return one page of results' do
        create_list(:post, 16)
        get :index
        expect(assigns(:posts).length).to eq(10)
        expect(response).to have_http_status(200)
      end
    end
    context 'when specifying page out of range' do
      it 'should return no results' do
        create_list(:post, 2)
        get :index, params: { page: 4 }
        expect(assigns(:posts).length).to eq(0)
        expect(response).to have_http_status(200)
      end
    end
{'fraction_non_alphanumeric': 0.10265646105357946, 'fraction_numerical': 0.01981089599279604, 'mean_word_length': 2.9119718309859155, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4217079', 'n_tokens_mistral': 717, 'n_tokens_neox': 665, 'n_words': 205}