<commit_before>require 'test_helper'

class PostsController
  class TestCase < ActiveSupport::TestCase
    include FocusedController::TestHelper

    setup do
      @post = Post.create(:title => 'Hello', :body => 'Omg')
    end
  end

  class IndexTest < TestCase
    test "should get index" do
      req
      assert_response :success
      assert_not_nil controller.posts
    end
  end

  class NewTest < TestCase
    test "should get new" do
      req
      assert_response :success
    end
  end

  class CreateTest < TestCase
    test "should create post" do
      assert_difference('Post.count') do
        req :post => @post.attributes
      end

      assert_redirected_to post_path(controller.post)
    end
  end

  class ShowTest < TestCase
    test "should show post" do
      req :id => @post.id
      assert_response :success
    end
  end

  class EditTest < TestCase
    test "should get edit" do
      req :id => @post.id
      assert_response :success
    end
  end

  class UpdateTest < TestCase
    test "should update post" do
      req :id => @post.id
      assert_redirected_to post_path(@controller.post)
    end
  end

  class DestroyTest < TestCase
    test "should destroy post" do
      assert_difference('Post.count', -1) do
        req :id => @post.id
      end

      assert_redirected_to posts_path
    end
  end
end<commit_msg>use method<commit_after>require 'test_helper'

class PostsController
  class TestCase < ActiveSupport::TestCase
    include FocusedController::TestHelper

    setup do
      @post = Post.create(:title => 'Hello', :body => 'Omg')
    end
  end

  class IndexTest < TestCase
    test "should get index" do
      req
      assert_response :success
      assert_not_nil controller.posts
    end
  end

  class NewTest < TestCase
    test "should get new" do
      req
      assert_response :success
    end
  end

  class CreateTest < TestCase
    test "should create post" do
      assert_difference('Post.count') do
        req :post => @post.attributes
      end

      assert_redirected_to post_path(controller.post)
    end
  end

  class ShowTest < TestCase
    test "should show post" do
      req :id => @post.id
      assert_response :success
    end
  end

  class EditTest < TestCase
    test "should get edit" do
      req :id => @post.id
      assert_response :success
    end
  end

  class UpdateTest < TestCase
    test "should update post" do
      req :id => @post.id
      assert_redirected_to post_path(controller.post)
    end
  end

  class DestroyTest < TestCase
    test "should destroy post" do
      assert_difference('Post.count', -1) do
        req :id => @post.id
      end

      assert_redirected_to posts_path
    end
  end
end
{'fraction_non_alphanumeric': 0.07037582903463523, 'fraction_numerical': 0.0007369196757553427, 'mean_word_length': 2.4630102040816326, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 17, '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': '5213655', 'n_tokens_mistral': 830, 'n_tokens_neox': 803, 'n_words': 258}