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 ExportFilesController do fixtures :all # This should return the minimal set of attributes required to create a valid # ExportFile. As you add validations to ExportFile, be sure to # update the return value of this method accordingly. def valid_attributes {} end # 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 # ExportFilesController. Be sure to keep this updated too. def valid_session {} end describe "GET index" do login_fixture_admin it "assigns all export_files as @export_files" do export_file = ExportFile.create! valid_attributes get :index, {} #, valid_session assigns(:export_files).should eq([export_file]) end end describe "GET show" do login_fixture_admin it "assigns the requested export_file as @export_file" do export_file = ExportFile.create! valid_attributes get :show, {:id => export_file.to_param} #, valid_session assigns(:export_file).should eq(export_file) end end describe "DELETE destroy" do login_fixture_admin it "destroys the requested export_file" do export_file = ExportFile.create! valid_attributes expect { delete :destroy, {:id => export_file.to_param} #, valid_session }.to change(ExportFile, :count).by(-1) end it "redirects to the export_files list" do export_file = ExportFile.create! valid_attributes delete :destroy, {:id => export_file.to_param} #, valid_session response.should redirect_to(export_files_url) end end end