require 'rails_helper' module Logistics module Core RSpec.describe TruckTypeBbWeightRangesController, type: :controller do let(:valid_attributes) { skip("Add a hash of attributes valid for your model") } let(:invalid_attributes) { skip("Add a hash of attributes invalid for your model") } # This should return the minimal set of values that should be in the session # in order to pass any filters (e.g. authentication) defined in # TruckTypeBbWeightRangesController. Be sure to keep this updated too. let(:valid_session) { {} } describe "GET #index" do it "assigns all truck_type_bb_weight_ranges as @truck_type_bb_weight_ranges" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes get :index, {}, valid_session expect(assigns(:truck_type_bb_weight_ranges)).to eq([truck_type_bb_weight_range]) end end describe "GET #show" do it "assigns the requested truck_type_bb_weight_range as @truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes get :show, {:id => truck_type_bb_weight_range.to_param}, valid_session expect(assigns(:truck_type_bb_weight_range)).to eq(truck_type_bb_weight_range) end end describe "GET #edit" do it "assigns the requested truck_type_bb_weight_range as @truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes get :edit, {:id => truck_type_bb_weight_range.to_param}, valid_session expect(assigns(:truck_type_bb_weight_range)).to eq(truck_type_bb_weight_range) end end describe "POST #create" do context "with valid params" do it "creates a new TruckTypeBbWeightRange" do expect { post :create, {:truck_type_bb_weight_range => valid_attributes}, valid_session }.to change(TruckTypeBbWeightRange, :count).by(1) end it "assigns a newly created truck_type_bb_weight_range as @truck_type_bb_weight_range" do post :create, {:truck_type_bb_weight_range => valid_attributes}, valid_session expect(assigns(:truck_type_bb_weight_range)).to be_a(TruckTypeBbWeightRange) expect(assigns(:truck_type_bb_weight_range)).to be_persisted end it "redirects to the created truck_type_bb_weight_range" do post :create, {:truck_type_bb_weight_range => valid_attributes}, valid_session expect(response).to redirect_to(TruckTypeBbWeightRange.last) end end context "with invalid params" do it "assigns a newly created but unsaved truck_type_bb_weight_range as @truck_type_bb_weight_range" do post :create, {:truck_type_bb_weight_range => invalid_attributes}, valid_session expect(assigns(:truck_type_bb_weight_range)).to be_a_new(TruckTypeBbWeightRange) end it "re-renders the 'new' template" do post :create, {:truck_type_bb_weight_range => invalid_attributes}, valid_session expect(response).to render_template("new") end end end describe "PUT #update" do context "with valid params" do let(:new_attributes) { skip("Add a hash of attributes valid for your model") } it "updates the requested truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes put :update, {:id => truck_type_bb_weight_range.to_param, :truck_type_bb_weight_range => new_attributes}, valid_session truck_type_bb_weight_range.reload skip("Add assertions for updated state") end it "assigns the requested truck_type_bb_weight_range as @truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes put :update, {:id => truck_type_bb_weight_range.to_param, :truck_type_bb_weight_range => valid_attributes}, valid_session expect(assigns(:truck_type_bb_weight_range)).to eq(truck_type_bb_weight_range) end it "redirects to the truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes put :update, {:id => truck_type_bb_weight_range.to_param, :truck_type_bb_weight_range => valid_attributes}, valid_session expect(response).to redirect_to(truck_type_bb_weight_range) end end context "with invalid params" do it "assigns the truck_type_bb_weight_range as @truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes put :update, {:id => truck_type_bb_weight_range.to_param, :truck_type_bb_weight_range => invalid_attributes}, valid_session expect(assigns(:truck_type_bb_weight_range)).to eq(truck_type_bb_weight_range) end it "re-renders the 'edit' template" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes put :update, {:id => truck_type_bb_weight_range.to_param, :truck_type_bb_weight_range => invalid_attributes}, valid_session expect(response).to render_template("edit") end end end describe "DELETE #destroy" do it "destroys the requested truck_type_bb_weight_range" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes expect { delete :destroy, {:id => truck_type_bb_weight_range.to_param}, valid_session }.to change(TruckTypeBbWeightRange, :count).by(-1) end it "redirects to the truck_type_bb_weight_ranges list" do truck_type_bb_weight_range = TruckTypeBbWeightRange.create! valid_attributes delete :destroy, {:id => truck_type_bb_weight_range.to_param}, valid_session expect(response).to redirect_to(truck_type_bb_weight_ranges_url) end end end end end