require 'rails_helper' module Logistics module Core RSpec.describe OutOfGaugeBbRatesController, 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 # OutOfGaugeBbRatesController. Be sure to keep this updated too. let(:valid_session) { {} } describe "GET #index" do it "assigns all out_of_gauge_bb_rates as @out_of_gauge_bb_rates" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes get :index, {}, valid_session expect(assigns(:out_of_gauge_bb_rates)).to eq([out_of_gauge_bb_rate]) end end describe "GET #show" do it "assigns the requested out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes get :show, {:id => out_of_gauge_bb_rate.to_param}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to eq(out_of_gauge_bb_rate) end end describe "GET #edit" do it "assigns the requested out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes get :edit, {:id => out_of_gauge_bb_rate.to_param}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to eq(out_of_gauge_bb_rate) end end describe "POST #create" do context "with valid params" do it "creates a new OutOfGaugeBbRate" do expect { post :create, {:out_of_gauge_bb_rate => valid_attributes}, valid_session }.to change(OutOfGaugeBbRate, :count).by(1) end it "assigns a newly created out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do post :create, {:out_of_gauge_bb_rate => valid_attributes}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to be_a(OutOfGaugeBbRate) expect(assigns(:out_of_gauge_bb_rate)).to be_persisted end it "redirects to the created out_of_gauge_bb_rate" do post :create, {:out_of_gauge_bb_rate => valid_attributes}, valid_session expect(response).to redirect_to(OutOfGaugeBbRate.last) end end context "with invalid params" do it "assigns a newly created but unsaved out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do post :create, {:out_of_gauge_bb_rate => invalid_attributes}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to be_a_new(OutOfGaugeBbRate) end it "re-renders the 'new' template" do post :create, {:out_of_gauge_bb_rate => 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 out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes put :update, {:id => out_of_gauge_bb_rate.to_param, :out_of_gauge_bb_rate => new_attributes}, valid_session out_of_gauge_bb_rate.reload skip("Add assertions for updated state") end it "assigns the requested out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes put :update, {:id => out_of_gauge_bb_rate.to_param, :out_of_gauge_bb_rate => valid_attributes}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to eq(out_of_gauge_bb_rate) end it "redirects to the out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes put :update, {:id => out_of_gauge_bb_rate.to_param, :out_of_gauge_bb_rate => valid_attributes}, valid_session expect(response).to redirect_to(out_of_gauge_bb_rate) end end context "with invalid params" do it "assigns the out_of_gauge_bb_rate as @out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes put :update, {:id => out_of_gauge_bb_rate.to_param, :out_of_gauge_bb_rate => invalid_attributes}, valid_session expect(assigns(:out_of_gauge_bb_rate)).to eq(out_of_gauge_bb_rate) end it "re-renders the 'edit' template" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes put :update, {:id => out_of_gauge_bb_rate.to_param, :out_of_gauge_bb_rate => invalid_attributes}, valid_session expect(response).to render_template("edit") end end end describe "DELETE #destroy" do it "destroys the requested out_of_gauge_bb_rate" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes expect { delete :destroy, {:id => out_of_gauge_bb_rate.to_param}, valid_session }.to change(OutOfGaugeBbRate, :count).by(-1) end it "redirects to the out_of_gauge_bb_rates list" do out_of_gauge_bb_rate = OutOfGaugeBbRate.create! valid_attributes delete :destroy, {:id => out_of_gauge_bb_rate.to_param}, valid_session expect(response).to redirect_to(out_of_gauge_bb_rates_url) end end end end end