<commit_before>require 'spec_helper'

# This spec was generated by rspec-rails when you ran the scaffold generator.
# It demonstrates how one might use RSpec to specify the controller code that
# was generated by Rails when you ran the scaffold generator.
#
# It assumes that the implementation code is generated by the rails scaffold
# generator.  If you are using any extension libraries to generate different
# controller code, this generated spec may or may not pass.
#
# It only uses APIs available in rails and/or rspec-rails.  There are a number
# of tools you can use to make these specs even more expressive, but we're
# sticking to rails and rspec-rails APIs to keep things simple and stable.
#
# Compared to earlier versions of this generator, there is very limited use of
# stubs and message expectations in this spec.  Stubs are only used when there
# is no simpler way to get a handle on the object needed for the example.
# Message expectations are only used when there is no simpler way to specify
# that an instance is receiving a specific message.

describe BprocesController do
  render_views

  # This should return the minimal set of attributes required to create a valid
  # Bproce. As you add validations to Bproce, be sure to
  # update the return value of this method accordingly.
  def valid_attributes
    {
      :id => 1,
      :shortname => "test_short",
      :name => "test_name10",
      :fullname => "test_fullname"
    }
  end

  before(:each) do
    @user = User.new(:email => "<EMAIL>", :username => "test_w")
    @user.roles << Role.find_or_create_by(name: "admin")
    @user.save
    sign_in @user
  end

  describe "GET index" do
    it "assigns all bproces as @bproces" do
      bproce = Bproce.create! valid_attributes
      get :index
      assigns(:bproces).should eq([bproce])
    end
  end

  describe "GET show" do
    it "assigns the requested bproce as @bproce" do
      bproce = Bproce.create! valid_attributes
      get :show, :id => bproce.id
      assigns(:bproce).should eq(bproce)
    end
  end

  describe "GET new" do
    it "assigns a new bproce as @bproce" do
      get :new
      assigns(:bproce).should be_a_new(Bproce)
    end
  end

  describe "GET edit" do
    it "assigns the requested bproce as @bproce" do
      bproce = Bproce.create! valid_attributes
      get :edit, :id => bproce.id
      assigns(:bproce).should eq(bproce)
    end
  end

  describe "POST create" do
    describe "with valid params" do
      it "creates a new Bproce" do
        expect {
          post :create, :bproce => valid_attributes
        }.to change(Bproce, :count).by(1)
      end

      it "assigns a newly created bproce as @bproce" do
        post :create, :bproce => valid_attributes
        assigns(:bproce).should be_a(Bproce)
        assigns(:bproce).should be_persisted
      end

      it "redirects to the created bproce" do
        post :create, :bproce => valid_attributes
        response.should redirect_to(Bproce.last)
      end
    end

    describe "with invalid params" do
      it "assigns a newly created but unsaved bproce as @bproce" do
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        post :create, :bproce => {}
        assigns(:bproce).should be_a_new(Bproce)
      end

      it "re-renders the 'new' template" do
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        post :create, :bproce => {}
        response.should_not render_template("new")
      end
    end
  end

  describe "PUT update" do
    describe "with valid params" do
      it "updates the requested bproce" do
        bproce = Bproce.create! valid_attributes
        # Assuming there are no other bproces in the database, this
        # specifies that the Bproce created on the previous line
        # receives the :update_attributes message with whatever params are
        # submitted in the request.
        Bproce.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
        put :update, :id => bproce.id, :bproce => {'these' => 'params'}
      end

      it "assigns the requested bproce as @bproce" do
        bproce = Bproce.create! valid_attributes
        put :update, :id => bproce.id, :bproce => valid_attributes
        assigns(:bproce).should eq(bproce)
      end

      it "redirects to the bproce" do
        bproce = Bproce.create! valid_attributes
        put :update, :id => bproce.id, :bproce => valid_attributes
        response.should redirect_to(bproce)
      end
    end

    describe "with invalid params" do
      it "assigns the bproce as @bproce" do
        bproce = Bproce.create! valid_attributes
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        put :update, :id => bproce.id, :bproce => {}
        assigns(:bproce).should eq(bproce)
      end

      it "re-renders the 'edit' template" do
        bproce = Bproce.create! valid_attributes
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        put :update, :id => bproce.id, :bproce => {}
        response.should_not render_template("edit")
      end
    end
  end

  describe "DELETE destroy" do
    it "destroys the requested bproce" do
      bproce = Bproce.create! valid_attributes
      expect {
        delete :destroy, :id => bproce.id
      }.to change(Bproce, :count).by(-1)
    end

    it "redirects to the bproces list" do
      bproce = Bproce.create! valid_attributes
      delete :destroy, :id => bproce.id
      response.should redirect_to(bproces_url)
    end
  end

end
<commit_msg>fix: passed test bproces controller<commit_after>require 'spec_helper'

describe BprocesController do
  render_views

  def valid_attributes
    {
      :id => 1,
      :shortname => "test_short",
      :name => "test_name10",
      :fullname => "test_fullname"
    }
  end

  before(:each) do
    @user = FactoryGirl.create(:user)
    @user.roles << Role.find_or_create_by(name: 'admin', description: 'description')
    sign_in @user
  end

  describe "GET index" do
    it "assigns all bproces as @bproces" do
      bproce = Bproce.create! valid_attributes
      get :index
      assigns(:bproces).should eq([bproce])
    end
  end

  describe "GET show" do
    it "assigns the requested bproce as @bproce" do
      bproce = Bproce.create! valid_attributes
      get :show, :id => bproce.id
      assigns(:bproce).should eq(bproce)
    end
  end

  describe "GET new" do
    it "assigns a new bproce as @bproce" do
      get :new
      assigns(:bproce).should be_a_new(Bproce)
    end
  end

  describe "GET edit" do
    it "assigns the requested bproce as @bproce" do
      bproce = Bproce.create! valid_attributes
      get :edit, :id => bproce.id
      assigns(:bproce).should eq(bproce)
    end
  end

  describe "POST create" do
    describe "with valid params" do
      it "creates a new Bproce" do
        expect {
          post :create, :bproce => valid_attributes
        }.to change(Bproce, :count).by(1)
      end

      it "assigns a newly created bproce as @bproce" do
        post :create, :bproce => valid_attributes
        assigns(:bproce).should be_a(Bproce)
        assigns(:bproce).should be_persisted
      end

      it "redirects to the created bproce" do
        post :create, :bproce => valid_attributes
        response.should redirect_to(Bproce.last)
      end
    end

    describe "with invalid params" do
      it "assigns a newly created but unsaved bproce as @bproce" do
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        post :create, :bproce => {}
        assigns(:bproce).should be_a_new(Bproce)
      end

      it "re-renders the 'new' template" do
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        post :create, :bproce => {}
        response.should_not render_template("new")
      end
    end
  end

  describe "PUT update" do
    describe "with valid params" do
      it "updates the requested bproce" do
        bproce = Bproce.create! valid_attributes
        # Assuming there are no other bproces in the database, this
        # specifies that the Bproce created on the previous line
        # receives the :update_attributes message with whatever params are
        # submitted in the request.
        Bproce.any_instance.should_receive(:update_attributes).with({'these' => 'params'})
        put :update, :id => bproce.id, :bproce => {'these' => 'params'}
      end

      it "assigns the requested bproce as @bproce" do
        bproce = Bproce.create! valid_attributes
        put :update, :id => bproce.id, :bproce => valid_attributes
        assigns(:bproce).should eq(bproce)
      end

      it "redirects to the bproce" do
        bproce = Bproce.create! valid_attributes
        put :update, :id => bproce.id, :bproce => valid_attributes
        response.should redirect_to(bproce)
      end
    end

    describe "with invalid params" do
      it "assigns the bproce as @bproce" do
        bproce = Bproce.create! valid_attributes
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        put :update, :id => bproce.id, :bproce => {}
        assigns(:bproce).should eq(bproce)
      end

      it "re-renders the 'edit' template" do
        bproce = Bproce.create! valid_attributes
        # Trigger the behavior that occurs when invalid params are submitted
        Bproce.any_instance.stub(:save).and_return(false)
        put :update, :id => bproce.id, :bproce => {}
        response.should_not render_template("edit")
      end
    end
  end

  describe "DELETE destroy" do
    it "destroys the requested bproce" do
      bproce = Bproce.create! valid_attributes
      expect {
        delete :destroy, :id => bproce.id
      }.to change(Bproce, :count).by(-1)
    end

    it "redirects to the bproces list" do
      bproce = Bproce.create! valid_attributes
      delete :destroy, :id => bproce.id
      response.should redirect_to(bproces_url)
    end
  end

end

{'fraction_non_alphanumeric': 0.08581587545646742, 'fraction_numerical': 0.0009609840476648087, 'mean_word_length': 2.718113612004287, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 56, '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': '5703986', 'n_tokens_mistral': 3282, 'n_tokens_neox': 3211, 'n_words': 1068}